I have an OCaml 3.11 program that prints out the arguments on the command line:

  let main =Array.iter (Printf.printf "arg = %s\n") Sys.argv

On Linux, if I provide a command line argument containing 8-bit characters,
like é (an e with an acute accent), the program above, compiled with ocamlopt
or ocamlc, prints them faithfully.

For Windows, I can compile the program above with ocamlc on Windows, or 
cross-compile
it with MinGW-ocaml on Linux.  In both cases, any 8-bit characters in the 
command
line are printed as garbage.  I've tried running the program from rxvt (a shell 
for
Cygwin) and Windows cmd.exe.

Why does the behavior differ?

Although it's not a particular concern to me, the OCaml interpreter handles 
8-bit characters
on Linux and Windows differently.  From the earlier part of my message, you'd 
think that
Linux ocaml handles such characters well, and Windows ocaml, not well -- but 
just the
opposite holds!  In Windows, if I enter a string containing an 8-bit character, 
the interpreter spits
it back faithfully:

  # "é";;
  - : string = "é"

But in Linux:

  # "é";;
  - : string = "\195\169"

Why this inconsistency?

-- Paul
--
Paul Steckler
National ICT Australia
paul DOT steckler AT nicta.com.au

The information in this e-mail may be confidential and subject to legal 
professional privilege and/or copyright. National ICT Australia Limited accepts 
no liability for any damage caused by this email or its attachments.

_______________________________________________
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs

Reply via email to