On Sun, Jun 25, 2006 at 07:14:51AM -0000, roparzhhemon
wrote:
> Example 2 :
>
> # let s2="\195\177";;
> val s2 : string = "\195\177"
> # String.length s2;;
> - : int = 2
> # print_string s2;;
> ñ- : unit = ()
>
> Why does the Caml compiler see two characters here ?
OCaml compiler sees two BYTES here.
Your terminal is set to UTF-8, where those two bytes
translate into a
single character. Compare for example:
http://www.goog
le.com/search?q=%c3%b1
(where hex C3 = dec 195 and hex B1 = dec 177).
Rich.
PS. Beware that some functions in the String module treat
everything
as ISO-8859-1/15, and will mutilate nicely formed UTF-8
strings; in
particular String.uppercase and String.lowercase.
--
Richard Jones, CTO Merjis Ltd.
Merjis - web marketing and technology - http://merjis.com
Team Notepad - intranets and extranets for business - http://team-notepad.com
------------------------ Yahoo! Groups Sponsor
--------------------~-->
Check out the new improvements in Yahoo! Groups email.
http://us.click.yahoo.com/6pRQfA/fOaOAA/yQLSAA/saFolB/TM
------------------------------------------------------------
--------~->
Archives up to August 22, 2005 are also downloadable at http://www.connettivo.net/cntprojects/ocaml_beginners/
The archives of the very official ocaml list (the seniors'
one) can be found at http://caml.inria.fr
Attachments are banned and you're asked to be polite, avoid
flames etc.
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http:/
/groups.yahoo.com/group/ocaml_beginners/
<*> To unsubscribe from this group, send an email to:
ocaml_beginners-unsubscribe@yahoogroups.com
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.c
om/info/terms/
|