[wxhaskell-devel] Strings reduced to 1 letter on windows, on a program that otherwise works well on linux

2011-09-21 Thread David Virebayre
Bonjour,

I'm posting this hoping that someone has seen the same problem; if
nobody has, I'll make an example program, post the source and give
screenshots.

I have a program that works fine on linux.

I followed the instructions to install wxhaskell on windows, all went
fine. it's with wxWidgets 2.8.10.

I compiled the source on windows, and when I run the program, all the
strings are reduced to the first character: Labels in buttons, text
fields, name of the app's icon (which fire an error because the icon
doesn't exist) etc...

Anyone has seen this before ?

David.

--
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2dcopy1
___
wxhaskell-devel mailing list
wxhaskell-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wxhaskell-devel


Re: [wxhaskell-devel] Strings reduced to 1 letter on windows, on a program that otherwise works well on linux

2011-09-21 Thread Jeremy O'Donoghue
Hi David,

On 21 September 2011 16:49, David Virebayre dav.vire+hask...@gmail.comwrote:

 Bonjour,

 I'm posting this hoping that someone has seen the same problem; if
 nobody has, I'll make an example program, post the source and give
 screenshots.

 I have a program that works fine on linux.

 I followed the instructions to install wxhaskell on windows, all went
 fine. it's with wxWidgets 2.8.10.

 I compiled the source on windows, and when I run the program, all the
 strings are reduced to the first character: Labels in buttons, text
 fields, name of the app's icon (which fire an error because the icon
 doesn't exist) etc...

 Anyone has seen this before ?


This sounds like a Unicode problem.

On Windows, strings are natively encoded in UTF16, which uses two bytes to
represent a character. In the common case (for Western European languages),
most characters have the upper byte set to zero (as the codes used are
backwards compatible with ASCII).

Now, older wxWidgets (anything  wxWidgets 2.9) can be built as Unicode
(where Strings are represented as wchar_t *) or ASCII (where strings are a C
char*) - a feature to enable wxWidgets to wrap older code which believes
that only Western European languages should be able to be expressed ;-)

I would start by checking the wxWidgets libraries you are linking. If you
have wxmswusomething then it's Unicode - otherwise it is ASCII.

Because of the coding, the ASCII wxWidgets libraries see the '0' as the
upper byte of a Unicode string as a string terminator.

Regards
Jeremy
--
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2dcopy1___
wxhaskell-devel mailing list
wxhaskell-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wxhaskell-devel