Basil A. Daoust wrote:
>Hi,
>I've run into a problem.
>I have a data file that contains strings like
>[- Ω -] - [ Omega ] In case its messed up when I post this
>[◄●►] - [ < o > ] dark filled in shapes.
>As well it contains non-displayed chars that seems to have a ord value
>of 160.
>
>Anyway the web pages save fine, they also display fine in word and notepad.
>If I try and read/write them with perl however things turn bad.
>The Omega symbol seems to be ord 937 which prints as Ω
>Using a hash I mapped one file, which of course doesn't include all
>special chars but it shows the problem.
>Here is the last part of the table.
>Char y ==> 121
>Char z ==> 122
>Char { ==> 123
>Char } ==> 125
>Char ~ ==> 126
>Char   ==> 160
>Char Ω ==> 937
>Char Γû║ ==> 9658
>Char Γùä ==> 9668
>Char ΓùÅ ==> 9679
>
>I added the following use to remove the "wide char errors" when printing.
>use open ':utf8';
>binmode(STDOUT, ":utf8");
>
>But really how can I know what the right unicode set is.
>How can I get them to print correctly to a file is fine, and how can I
>get that files saved as a unicode instead of ascii?
>
>In Windows I can save a file as Unicode or UTF-8 what would be the perl
>equivalent to unicode?
>
>thanks in advance
>
>
>
Well maybe ya all no a better solution, but I found one that works on
Windows XP.
a) switch the console from default font to a TT font, and save it as
the new default for all command windows.
b) add `chcp 65001` to the beginning of the perl script that needs
unicode support, chcp changes the code page, 65001 is utf-8.
Char ==> 160
Char Ω ==> 937
Char ► ==> 9658
Char ◄ ==> 9668
Char ● ==> 9679
Thanks all.
_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs