CLR Bridge: "€" (Euro) Character does not work

Posted by Fabian Frank on 30-Jan-2014 11:32

Using OE 11.1 "€" (Euro) chars get filtered out of strings when passed to .net via clr bridge. I first encountered the problem with winforms TextBox Text property but the code below is easier to test and shows the issue is not related to UI Elements.

The MessageBox shows "1a" instead of "1€a". The length of the resulting string is 3, if you cut out the second
char using substring it will be an empty string.


DEF VAR v-sb AS System.Text.StringBuilder NO-UNDO.
v-sb = new System.Text.StringBuilder().
v-sb:Append("1").
v-sb:Append("€").
v-sb:Append("a").
MESSAGE v-sb:ToString()
VIEW-AS ALERT-BOX.

All Replies

Posted by Thomas Mercer-Hursh on 30-Jan-2014 11:46

This is almost certainly a code page issue.  Which ones are you using.

Posted by Garry Hall on 30-Jan-2014 11:47

Please check your -cpinternal and -cpstream.

Using 11.1, I ran prowin32 -cpinternal 1252. I cut and pasted your code into the Procedure Editor, and it ran correctly. If I use a codepage that does not contain the the Euro char, I get the behaviour you saw.

Posted by Fabian Frank on 30-Jan-2014 12:20

Thank you for the quick respone. I was using ISO-8859-1 and was not aware that the € char is not included because the other special chars needed in germany are.

Posted by Thomas Mercer-Hursh on 30-Jan-2014 12:50

You might look at 8859-15

Posted by Fabian Frank on 30-Jan-2014 13:32

I was just studying 1252 vs 8859-1 vs 8859-15 to make sure that i never have to ask such a lame codepage question again ;-)

Posted by Thomas Mercer-Hursh on 30-Jan-2014 13:47

Code pages are a real PITA.  Nothing short of UTF really answers all questions.

Posted by Paul Clare on 31-Jan-2014 07:55

If you're using Windows best to use the Microsoft code pages - 1252.

This thread is closed