Re: charset issue on Windows help needed



(Second attempt. The previous one got truncated).

On Tuesday 16 September 2014 21:19:51 Fernando Rodriguez wrote:
Sorry for taking so long, I've been struggling with something of my
own. Did you ever get this sorted?

I'm not sure what's wrong. Are you running gdb from the console in
windows or from an IDE?

I would try printing the bytes as hexadecimal to make sure you're not
being lied to (use a short pointer to print them)
or display it on a
messagebox:

MessageBoxW(NULL, val_win, NULL, NULL);

Also how did you set the env variable?
Can you echo it on the console or look it up on the GUI to make sure
it's set right?
Good suggestion ! Which has helped me eliminate several bogus issues:

1. The default font of the Windows console (cmd.exe) can't display wide 
characters and substitutes them. Changing the font does display the 
proper value of the environment variable when I run 'echo 
%GNC_DOT_DIR%'. (You got to love Windows for such a treat...)

2. I was running gdb from within msys which has its own way 
interpretation of the environment apparently. At least echo $GNC_DOT_DIR 
in an msys shell returns the wrong value. So until this is cleared out 
with the mingw developers I'm avoiding the msys shell for further 
debugging.

3. And gdb is lying to me as well. Even when run straight from the 
windows console, it plainly refuses to show me the wide character. This 
was confirmed by adding the MessageBox line in my code as you suggested 
and also by using a printf to a log file.

Now that I have identified these distractions I have removed my Windows 
specific exception code again and... g_getenv actually does return the 
proper utf-8 encoded parameter (confirmed by a printf). And 
g_get_home_dir does the right thing as well...

It turns out I was completely chasing the wrong rabbit :(

I started this whole investigation because our guile wrappers 
incorrectly deal with a utf-8 encoded string it gets from the C code. 
The poor behaviour of the default font for windows console, msys' 
handling of environment variables and gdb mangling the strings all led 
me in the wrong direction.

Thanks a lot to all for your help. I can now return to the real core of 
my problem: figure out why guile mangles the string I'm passing from C. 
But that's for another mailing list.

Geert


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]