r3wp [groups: 83 posts: 189283]
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

World: r3wp

[Core] Discuss core issues

Graham
10-Apr-2009
[13549]
but I think I have to encode accented characters as well ...
Ammon
10-Apr-2009
[13550]
Yeah, you need to be escaping a lot more than just those characters 
to really do it right.  I can't help you with building the table 
of escapes, but this version should be a lot faster if you're escaping 
large quantities of text...

encode-html: func [

    "Make HTML tags into HTML viewable escapes (for posting code)"
    text
][
	parse/all text [
		any [
			h: #"&" (h: change/part h "&" 1) :h |
			h: #"<" (h: change/part h "&lt;" 1) :h |
			h: #">" (h: change/part h "&gt;" 1) :h |
			h: #""" (h: change/part h "&quot;" 1) :h |
			h: #"'" (h: change/part h "&apos;" 1) :h |
			h: #"€" (h: change/part h "&#8364;" 1) :h |
			skip
		]
    ]
	text
]
PeterWood
10-Apr-2009
[13551]
I have one which converts iso-8859-1 to html and escapes characters 
where necessary.
Ammon
10-Apr-2009
[13552]
Are you using Parse in that Peter?
PeterWood
10-Apr-2009
[13553]
Yes
Ammon
10-Apr-2009
[13554]
Sweet.  Is it available on REBOL.org?
PeterWood
10-Apr-2009
[13555]
Not yet. It is part of some encoding utilities that I am writing 
to help resolve the character encoding issues in REBOL.org. I have 
a number of other conversion functions to wrtie. I will then publish 
them on REBOL.org
Ammon
10-Apr-2009
[13556]
Good to know.  I'll be watching for them!
Graham
10-Apr-2009
[13557x2]
me 2
Ammon, 'replace is native .. are  you sure parse will be faster?
Dockimbel
10-Apr-2009
[13559]
Graham: you can find such function in Cheyenne sources in %UniServe/libs/html.r. 
It supports iso-8859-1 entities.
Ammon
10-Apr-2009
[13560]
Yes.  I've tested it heavily.  Well, not this particular implementation 
but one that's a lot similar.
Dockimbel
10-Apr-2009
[13561]
'replace is not native in R2.
PeterWood
10-Apr-2009
[13562]
Romano once wrote "if you need speed, parse is you friend.


Smart fellow Romano, much smarter than me. So I'd never question 
parse's speed.
Graham
10-Apr-2009
[13563x3]
oops .. stand corrected.
doc .. didn't notice/remember that you had those as well.
Especially since I using it in a rsp page ...
Gabriele
10-Apr-2009
[13566]
if you can wait for it (release does not depend on me), i have any-charset 
to utf-8 and utf-8 to html (and vice-versa, with support for all 
known named entities as well)
PeterWood
10-Apr-2009
[13567]
Any idea how long the waitt may be?
Oldes
10-Apr-2009
[13568]
very long.. I think such a messages comes already very long time.
Dockimbel
10-Apr-2009
[13569]
Graham: you should look at the RSP doc more often : http://cheyenne-server.org/docs/rsp-api.html#def-25
;-)
Graham
10-Apr-2009
[13570]
In my defence, I was looking for encode-html which is a verb, whereas 
html-encode is not clearly such :)
Dockimbel
10-Apr-2009
[13571]
You're right, having the verb first is more rebolish.
Gabriele
11-Apr-2009
[13572]
Peter: does not depend on me. The code is ready for release (actually, 
there is one thing i have to do first, but it should take a couple 
hours max), so it could happen "tomorrow" or in two months.
PeterWood
11-Apr-2009
[13573]
Thanks, Gabriele. I'll probably go ahead and try to build something 
for use in the Library system but will happily stop work when your 
code is released.
Henrik
14-Apr-2009
[13574]
Is there documentation anywhere for using [catch] in a function header? 
It's a nice trick, but I can't figure out how it was deduced that 
this would work:

f: func [[catch] var] [
	if var = 'bad [throw make error! "Something bad happened."]
]

I first saw Gabriele doing it a while ago.
Geomol
14-Apr-2009
[13575]
http://www.rebol.com/docs/core23/rebolcore-9.html#section-7
Henrik
14-Apr-2009
[13576]
thanks
Will
14-Apr-2009
[13577]
thanks
eFishAnt
16-Apr-2009
[13578x3]
Hmmn, I am running a script, but not as CGI, on a remote 'nix box. 
 This script uses other scripts by 'do


The main script runs, but at the first use of parse rules from a 
do script, it fails.  Is there a magic setting of usage flags or 
file permissions to accomplish this?

$rebol -s main.r

runs main, but doesn't do the do %blah.r script from inside
file permissions are set to 755 (rwxr-xr-x) and I am running them 
at superuser level
It is weird, because from inside the REBOL console, a list-dir does 
not show the other scripts, like blah.r in the example above which 
main.r tries to do.
Geomol
16-Apr-2009
[13581x2]
Are there any type of links involved? Symbolic links, etc. See the 
UNIX command: ln
It sounds to me, that some of those files are not common files. Try: 
ls -la
eFishAnt
16-Apr-2009
[13583x2]
$ ln hex-dump.r

ln: creating hard link `./hex-dump.r' to `hex-dump.r': File exists
-rw-r--r--  1 steves fusers  3657 Apr 16 14:38 hex-dump.r
Geomol
16-Apr-2009
[13585]
And you can't see that file with list-dir inside REBOL?
eFishAnt
16-Apr-2009
[13586x3]
>list-dir ;after the file crashes...aha, I could see the files before 
doing the main.r.
main.r  main.r  


My scripts work fine on Windoze.  I am now thinking from this...I 
do a change-directory to get the directory of where I am running 
and I write my data into the current directory.  In Windoze, the 
change-directory seemed needed to pick up the directory I am in. 
 I'll bet 'nix doesn't like that, and perhaps needs the full pathnamem 
from the root, or soemthing like that.
I think you got me off dead center, at least.
I think if 'nix, then don't change-dir might work.
[unknown: 5]
16-Apr-2009
[13589]
Remember *nix is case sensitive also on pathnames.
eFishAnt
16-Apr-2009
[13590x2]
My stuff is all lowercase, but good point.
my bad.  I wrote the script to automatically work for View or Enbase, 
but this 'nix is actually Core.  So it is using the encap branch 
of #include.


Sorry for the confusion.  going to extract the bullet from my foot....;-)
[unknown: 5]
16-Apr-2009
[13592]
Ahhh, I did the same thing with Tretbase when I put on my webhost. 
 But my problem was different as I used a /view option in my script 
that I needed to change.
Geomol
16-Apr-2009
[13593]
Good if you got it figured out! Often it helps to talk to others. 
All the time, I see the problem myself, the second I start telling 
others about it. :-) And then I get the looks. :-D
[unknown: 5]
16-Apr-2009
[13594]
Yeah everyone does that at some point.
eFishAnt
16-Apr-2009
[13595x3]
AltME therapy
yahoo, the seven script application is running remotely.  The errors 
were logic error on my part.
I don't believe Java can claim that level of cross-platform!
Geomol
16-Apr-2009
[13598]
Cool! :-)