Re: console charset
- Posted by jimcbrown (admin) Jan 10, 2010
- 1448 views
I have an entry level question. :-> Whenever I print something onto the screen some special characters are not readable for me. E.g.
puts(1,"Helló világ!") -- means "Hello world" in Hungarian
would appear incorrectly due to the "ó" and "á" characters. I suppose it is because of the codepage differences. But is there a simple way of defining that the script I saved in UTF-8 should print to the console/command line the text as ibm852 charset? I'm equally interested in Win and Linux solution...
Thanks for any tips/hints/ideas in advance!
Salix
Not really. Euphoria right now doesn't handle charset conversion at all, it just reads whats in the text file and spits it out raw.
On Unix, you can replace
puts(1,"Helló világ!") -- means "Hello world" in Hungarian
with
system("echo -n 'Helló világ!' | iconv -t ibm852 -f utf8") -- means "Hello world" in Hungarian
assuming your console/xterm/etc is set up to use ibm852 as the console charset. (My xterms/Terminals are set up to use UTF-8 as the charset.)
iconv has been ported to Windows (Mingw has a iconv.exe I believe), so if you can't find a better option, at least you have something portable...