472,126 Members | 1,569 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,126 software developers and data experts.

parsing the output using string.split and current locale..

Hello,

I have a legacy unmanaged application that returns property=value
pairs separated by chr(252)and I am trying to parse this output from
C# using string.split method.

This works fine as long as the default locale is en-US. However, the
moment, I change it to say Greek/Portuguese, the parsing logic goofs
up. I don't have access to the source code of legacy application to
make changes.

Is there any way, by which, I can change the parsing logic such that
it works irrespective of the locale?

Thanks.
-Prasad
Nov 17 '05 #1
1 1745


p1=v1üp2=v2üp3=v3
p1=v1³p2=v2³p3=v3

Shouldn't be necessary to change anything in the legacy application, but
you need to change the character to split with. I suspect chr(252) is ü
in USA and ³ in Greece, both with byte value 252, but with different
encoding.

You could try to grab the character for byte value 252 using
Encoding.Default which is the default encoding used for whatever language
the OS is set to use.

char splitCharacter = Encoding.Default.GetString(new byte[]{252})[0];
--
Happy Coding!
Morten Wennevik [C# MVP]
Nov 17 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

8 posts views Thread by Gerrit Holl | last post: by
6 posts views Thread by Tuang | last post: by
9 posts views Thread by Thomas W | last post: by
11 posts views Thread by Roger Leigh | last post: by
6 posts views Thread by Tim N. van der Leeuw | last post: by
1 post views Thread by Malcolm Greene | last post: by
8 posts views Thread by =?Utf-8?B?TTFpUw==?= | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.