Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] Re: Re[2]: utf8-encode

From: rotenca:telvia:it at: 12-Jun-2002 23:36

> or this shorter and faster version but not so clear to understand:
And this is mine (more fast and more criptic :-) I do not know utf8, i copied the logic of your code. This works also under actual View 1.2.1.3.1 I think parse is the best way to go. utf8-encode: func[ "Encodes the string data to UTF-8" str [any-string!] "string to encode" /local c h ][ ;if you remove 'copy you can change the original string parse/all copy str [ any [ h: skip ( if 127 < c: first h [ h: change h c / 64 or 192 insert h c and 63 or 128 ] ) :h skip ] ] head h ] --- Ciao Romano