Hi,

I have a real stumper of an issue...I am creating a string, character by
character by doing a:

Do
S = S & CHR(X)
Loop while ....

The value of X will randomly vary from 0 to 255 (FF). And, with my
Smartphone's "Locale" setting to "English", the string is built of the
proper individual characters representing the specified values for X.

But, if a user's Smartphone has their "Locale" set to "Chinese", the CHR()
function doesn't appear to create the proper characters for X values above
127 (highest ANSI code). For example, if the sequential values of X are 237,
207, 45.....if I then loop through the string and read the ASC() of each
individual character, I will get 31, 31, 45 when the "Locale" is Chinese. If
I instead use CHRB(x), then the resulting ASC() values will be 169,169, 45
for a "Chinese" locale (NOTE: using the alternate chrb() method still works
fine on "English" locales)

I'm thinking that this is related to some Unicode issue, and that the
characters representing codes 128-255 are invalid for a Chinese "locale".
But, this is just a guess.

This is a real-pain of an issue to fix because I can not reproduce the
error - I have to keep "bugging" a [very helpful] Hong Kong user to test
different trace/debug versions on their "Chinese" local phone to see if it
fixes the issue, but this is not fair to them...

So, I am offering a reward of a FREE copy for one of my products:

http://www.omnisoft.com/products.asp

For anyone who first posts the solution to this issue...

Thanks a bunch!

-John Cody

Re: REWARD: chr() not working for Chinese "Locale" by Peter

Peter
Mon Oct 04 21:25:40 CDT 2004

Remember that pocket pc devices use UNICODE

Peter

"John Cody" <newsgroups@noospammmax-soft.com> wrote in message
news:O4mLojiqEHA.2588@TK2MSFTNGP12.phx.gbl...
> Hi,
>
> I have a real stumper of an issue...I am creating a string, character by
> character by doing a:
>
> Do
> S = S & CHR(X)
> Loop while ....
>
> The value of X will randomly vary from 0 to 255 (FF). And, with my
> Smartphone's "Locale" setting to "English", the string is built of the
> proper individual characters representing the specified values for X.
>
> But, if a user's Smartphone has their "Locale" set to "Chinese", the CHR()
> function doesn't appear to create the proper characters for X values above
> 127 (highest ANSI code). For example, if the sequential values of X are
237,
> 207, 45.....if I then loop through the string and read the ASC() of each
> individual character, I will get 31, 31, 45 when the "Locale" is Chinese.
If
> I instead use CHRB(x), then the resulting ASC() values will be 169,169, 45
> for a "Chinese" locale (NOTE: using the alternate chrb() method still
works
> fine on "English" locales)
>
> I'm thinking that this is related to some Unicode issue, and that the
> characters representing codes 128-255 are invalid for a Chinese "locale".
> But, this is just a guess.
>
> This is a real-pain of an issue to fix because I can not reproduce the
> error - I have to keep "bugging" a [very helpful] Hong Kong user to test
> different trace/debug versions on their "Chinese" local phone to see if it
> fixes the issue, but this is not fair to them...
>
> So, I am offering a reward of a FREE copy for one of my products:
>
> http://www.omnisoft.com/products.asp
>
> For anyone who first posts the solution to this issue...
>
> Thanks a bunch!
>
> -John Cody
>
>



Re: REWARD: chr() not working for Chinese "Locale" by John

John
Wed Oct 06 08:24:51 CDT 2004

Hi Peter,

Thanks for taking the time to respond :)

Yeah, as I mentioned in my post, I thought it has something to do with
Unicode, but I am just not sure exactly what...

I am now thinking that codes 128-255 in a Chinese "locale" (character set?)
have redundant (the same) characters in there, so it's not reliable to build
a string of characters from those codes, if the codes need to be
re-extractable using asc(mid(x,x,1)).

-John Cody

"Peter" <no_reply@mail.company.com> wrote in message
news:eAoTcKoqEHA.1272@TK2MSFTNGP09.phx.gbl...
> Remember that pocket pc devices use UNICODE
>
> Peter
>
> "John Cody" <newsgroups@noospammmax-soft.com> wrote in message
> news:O4mLojiqEHA.2588@TK2MSFTNGP12.phx.gbl...
> > Hi,
> >
> > I have a real stumper of an issue...I am creating a string, character
by
> > character by doing a:
> >
> > Do
> > S = S & CHR(X)
> > Loop while ....
> >
> > The value of X will randomly vary from 0 to 255 (FF). And, with my
> > Smartphone's "Locale" setting to "English", the string is built of the
> > proper individual characters representing the specified values for X.
> >
> > But, if a user's Smartphone has their "Locale" set to "Chinese", the
CHR()
> > function doesn't appear to create the proper characters for X values
above
> > 127 (highest ANSI code). For example, if the sequential values of X are
> 237,
> > 207, 45.....if I then loop through the string and read the ASC() of each
> > individual character, I will get 31, 31, 45 when the "Locale" is
Chinese.
> If
> > I instead use CHRB(x), then the resulting ASC() values will be 169,169,
45
> > for a "Chinese" locale (NOTE: using the alternate chrb() method still
> works
> > fine on "English" locales)
> >
> > I'm thinking that this is related to some Unicode issue, and that the
> > characters representing codes 128-255 are invalid for a Chinese
"locale".
> > But, this is just a guess.
> >
> > This is a real-pain of an issue to fix because I can not reproduce the
> > error - I have to keep "bugging" a [very helpful] Hong Kong user to test
> > different trace/debug versions on their "Chinese" local phone to see if
it
> > fixes the issue, but this is not fair to them...
> >
> > So, I am offering a reward of a FREE copy for one of my products:
> >
> > http://www.omnisoft.com/products.asp
> >
> > For anyone who first posts the solution to this issue...
> >
> > Thanks a bunch!
> >
> > -John Cody
> >
> >
>
>



Re: REWARD: chr() not working for Chinese "Locale" by Peter

Peter
Wed Oct 06 21:27:31 CDT 2004

Your problem seems to be related to the fact that unicode characters use two
bytes to represent a character, oposed to usual one byte per character,
basic latin characters use only one byte in unicode, the other is cero, this
is why your program works with English locale, but other languajes use both
bytes.

If tou are programing in VB or VB.net try using a string variable that uses
unicode, I program in eVC, and use CString data type which supports unicode.

For more information about unicode visit http://www.unicode.org

Peter

"John Cody" <newsgroups@noospammmax-soft.com> wrote in message
news:ekrPef6qEHA.3520@TK2MSFTNGP11.phx.gbl...
> Hi Peter,
>
> Thanks for taking the time to respond :)
>
> Yeah, as I mentioned in my post, I thought it has something to do with
> Unicode, but I am just not sure exactly what...
>
> I am now thinking that codes 128-255 in a Chinese "locale" (character
set?)
> have redundant (the same) characters in there, so it's not reliable to
build
> a string of characters from those codes, if the codes need to be
> re-extractable using asc(mid(x,x,1)).
>
> -John Cody
>
> "Peter" <no_reply@mail.company.com> wrote in message
> news:eAoTcKoqEHA.1272@TK2MSFTNGP09.phx.gbl...
> > Remember that pocket pc devices use UNICODE
> >
> > Peter
> >
> > "John Cody" <newsgroups@noospammmax-soft.com> wrote in message
> > news:O4mLojiqEHA.2588@TK2MSFTNGP12.phx.gbl...
> > > Hi,
> > >
> > > I have a real stumper of an issue...I am creating a string, character
> by
> > > character by doing a:
> > >
> > > Do
> > > S = S & CHR(X)
> > > Loop while ....
> > >
> > > The value of X will randomly vary from 0 to 255 (FF). And, with my
> > > Smartphone's "Locale" setting to "English", the string is built of the
> > > proper individual characters representing the specified values for X.
> > >
> > > But, if a user's Smartphone has their "Locale" set to "Chinese", the
> CHR()
> > > function doesn't appear to create the proper characters for X values
> above
> > > 127 (highest ANSI code). For example, if the sequential values of X
are
> > 237,
> > > 207, 45.....if I then loop through the string and read the ASC() of
each
> > > individual character, I will get 31, 31, 45 when the "Locale" is
> Chinese.
> > If
> > > I instead use CHRB(x), then the resulting ASC() values will be
169,169,
> 45
> > > for a "Chinese" locale (NOTE: using the alternate chrb() method still
> > works
> > > fine on "English" locales)
> > >
> > > I'm thinking that this is related to some Unicode issue, and that the
> > > characters representing codes 128-255 are invalid for a Chinese
> "locale".
> > > But, this is just a guess.
> > >
> > > This is a real-pain of an issue to fix because I can not reproduce the
> > > error - I have to keep "bugging" a [very helpful] Hong Kong user to
test
> > > different trace/debug versions on their "Chinese" local phone to see
if
> it
> > > fixes the issue, but this is not fair to them...
> > >
> > > So, I am offering a reward of a FREE copy for one of my products:
> > >
> > > http://www.omnisoft.com/products.asp
> > >
> > > For anyone who first posts the solution to this issue...
> > >
> > > Thanks a bunch!
> > >
> > > -John Cody
> > >
> > >
> >
> >
>
>



Re: REWARD: chr() not working for Chinese "Locale" by John

John
Thu Oct 07 22:54:12 CDT 2004

Hey Peter,

Thanks for that info - I will look into that angle for a solution and get
back to you.

-John Cody


"Peter" <no_reply@mail.company.com> wrote in message
news:%23QOMpUBrEHA.536@TK2MSFTNGP11.phx.gbl...
> Your problem seems to be related to the fact that unicode characters use
two
> bytes to represent a character, oposed to usual one byte per character,
> basic latin characters use only one byte in unicode, the other is cero,
this
> is why your program works with English locale, but other languajes use
both
> bytes.
>
> If tou are programing in VB or VB.net try using a string variable that
uses
> unicode, I program in eVC, and use CString data type which supports
unicode.
>
> For more information about unicode visit http://www.unicode.org
>
> Peter
>
> "John Cody" <newsgroups@noospammmax-soft.com> wrote in message
> news:ekrPef6qEHA.3520@TK2MSFTNGP11.phx.gbl...
> > Hi Peter,
> >
> > Thanks for taking the time to respond :)
> >
> > Yeah, as I mentioned in my post, I thought it has something to do with
> > Unicode, but I am just not sure exactly what...
> >
> > I am now thinking that codes 128-255 in a Chinese "locale" (character
> set?)
> > have redundant (the same) characters in there, so it's not reliable to
> build
> > a string of characters from those codes, if the codes need to be
> > re-extractable using asc(mid(x,x,1)).
> >
> > -John Cody
> >
> > "Peter" <no_reply@mail.company.com> wrote in message
> > news:eAoTcKoqEHA.1272@TK2MSFTNGP09.phx.gbl...
> > > Remember that pocket pc devices use UNICODE
> > >
> > > Peter
> > >
> > > "John Cody" <newsgroups@noospammmax-soft.com> wrote in message
> > > news:O4mLojiqEHA.2588@TK2MSFTNGP12.phx.gbl...
> > > > Hi,
> > > >
> > > > I have a real stumper of an issue...I am creating a string,
character
> > by
> > > > character by doing a:
> > > >
> > > > Do
> > > > S = S & CHR(X)
> > > > Loop while ....
> > > >
> > > > The value of X will randomly vary from 0 to 255 (FF). And, with my
> > > > Smartphone's "Locale" setting to "English", the string is built of
the
> > > > proper individual characters representing the specified values for
X.
> > > >
> > > > But, if a user's Smartphone has their "Locale" set to "Chinese", the
> > CHR()
> > > > function doesn't appear to create the proper characters for X values
> > above
> > > > 127 (highest ANSI code). For example, if the sequential values of X
> are
> > > 237,
> > > > 207, 45.....if I then loop through the string and read the ASC() of
> each
> > > > individual character, I will get 31, 31, 45 when the "Locale" is
> > Chinese.
> > > If
> > > > I instead use CHRB(x), then the resulting ASC() values will be
> 169,169,
> > 45
> > > > for a "Chinese" locale (NOTE: using the alternate chrb() method
still
> > > works
> > > > fine on "English" locales)
> > > >
> > > > I'm thinking that this is related to some Unicode issue, and that
the
> > > > characters representing codes 128-255 are invalid for a Chinese
> > "locale".
> > > > But, this is just a guess.
> > > >
> > > > This is a real-pain of an issue to fix because I can not reproduce
the
> > > > error - I have to keep "bugging" a [very helpful] Hong Kong user to
> test
> > > > different trace/debug versions on their "Chinese" local phone to see
> if
> > it
> > > > fixes the issue, but this is not fair to them...
> > > >
> > > > So, I am offering a reward of a FREE copy for one of my products:
> > > >
> > > > http://www.omnisoft.com/products.asp
> > > >
> > > > For anyone who first posts the solution to this issue...
> > > >
> > > > Thanks a bunch!
> > > >
> > > > -John Cody
> > > >
> > > >
> > >
> > >
> >
> >
>
>



Re: REWARD: chr() not working for Chinese "Locale" by John

John
Tue Oct 12 07:58:10 CDT 2004

Hi Peter,

Thanks for the info about latin and cero. I ended up using chrW and ascW to
properly use ascii codes 128-255 in strings on cero-based devices.

I want to send you an email and instructions how to obtain a free copy for
one of my products as thanks, but your email address in your posts is
invalid (probably for spam reasons). How can I obtain you email address to
send you the info?

-John Cody

"Peter" <no_reply@mail.company.com> wrote in message
news:%23QOMpUBrEHA.536@TK2MSFTNGP11.phx.gbl...
> Your problem seems to be related to the fact that unicode characters use
two
> bytes to represent a character, oposed to usual one byte per character,
> basic latin characters use only one byte in unicode, the other is cero,
this
> is why your program works with English locale, but other languajes use
both
> bytes.
>
> If tou are programing in VB or VB.net try using a string variable that
uses
> unicode, I program in eVC, and use CString data type which supports
unicode.
>
> For more information about unicode visit http://www.unicode.org
>
> Peter
>
> "John Cody" <newsgroups@noospammmax-soft.com> wrote in message
> news:ekrPef6qEHA.3520@TK2MSFTNGP11.phx.gbl...
> > Hi Peter,
> >
> > Thanks for taking the time to respond :)
> >
> > Yeah, as I mentioned in my post, I thought it has something to do with
> > Unicode, but I am just not sure exactly what...
> >
> > I am now thinking that codes 128-255 in a Chinese "locale" (character
> set?)
> > have redundant (the same) characters in there, so it's not reliable to
> build
> > a string of characters from those codes, if the codes need to be
> > re-extractable using asc(mid(x,x,1)).
> >
> > -John Cody
> >
> > "Peter" <no_reply@mail.company.com> wrote in message
> > news:eAoTcKoqEHA.1272@TK2MSFTNGP09.phx.gbl...
> > > Remember that pocket pc devices use UNICODE
> > >
> > > Peter
> > >
> > > "John Cody" <newsgroups@noospammmax-soft.com> wrote in message
> > > news:O4mLojiqEHA.2588@TK2MSFTNGP12.phx.gbl...
> > > > Hi,
> > > >
> > > > I have a real stumper of an issue...I am creating a string,
character
> > by
> > > > character by doing a:
> > > >
> > > > Do
> > > > S = S & CHR(X)
> > > > Loop while ....
> > > >
> > > > The value of X will randomly vary from 0 to 255 (FF). And, with my
> > > > Smartphone's "Locale" setting to "English", the string is built of
the
> > > > proper individual characters representing the specified values for
X.
> > > >
> > > > But, if a user's Smartphone has their "Locale" set to "Chinese", the
> > CHR()
> > > > function doesn't appear to create the proper characters for X values
> > above
> > > > 127 (highest ANSI code). For example, if the sequential values of X
> are
> > > 237,
> > > > 207, 45.....if I then loop through the string and read the ASC() of
> each
> > > > individual character, I will get 31, 31, 45 when the "Locale" is
> > Chinese.
> > > If
> > > > I instead use CHRB(x), then the resulting ASC() values will be
> 169,169,
> > 45
> > > > for a "Chinese" locale (NOTE: using the alternate chrb() method
still
> > > works
> > > > fine on "English" locales)
> > > >
> > > > I'm thinking that this is related to some Unicode issue, and that
the
> > > > characters representing codes 128-255 are invalid for a Chinese
> > "locale".
> > > > But, this is just a guess.
> > > >
> > > > This is a real-pain of an issue to fix because I can not reproduce
the
> > > > error - I have to keep "bugging" a [very helpful] Hong Kong user to
> test
> > > > different trace/debug versions on their "Chinese" local phone to see
> if
> > it
> > > > fixes the issue, but this is not fair to them...
> > > >
> > > > So, I am offering a reward of a FREE copy for one of my products:
> > > >
> > > > http://www.omnisoft.com/products.asp
> > > >
> > > > For anyone who first posts the solution to this issue...
> > > >
> > > > Thanks a bunch!
> > > >
> > > > -John Cody
> > > >
> > > >
> > >
> > >
> >
> >
>
>



Re: REWARD: chr() not working for Chinese "Locale" by Jon

Jon
Tue Oct 12 08:56:24 CDT 2004

John Cody <newsgroups@noospammmax-soft.com> wrote:
> Thanks for the info about latin and cero. I ended up using chrW and ascW to
> properly use ascii codes 128-255 in strings on cero-based devices.

That's a contradiction in terms. There *are* no correct ASCII codes
128-255. It's well worth getting clear exactly what is really what, in
what character set etc.

See http://www.pobox.com/~skeet/csharp/unicode.html for an explanation
which might help.

--
Jon Skeet - <skeet@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too

Re: REWARD: chr() not working for Chinese "Locale" by John

John
Tue Oct 12 21:25:42 CDT 2004

Hi Jon,

Basically, I have a routine that encrypts a string. Each character of the
resulting string can have a value of 0-255. It seems that with a "Latin"
based character set, characters 128 to 255 are all unique, so no matter what
value the encryption routine generated for each character, it was
reversible - meaning the original string could be de-crypted back to its
original value.

However, it appears that when a "cero" character set is used, there are a
lot of invalid/duplicate characters in the 128-255 range, so when the
encryption routine tries to set a character to a value in this range, say
213 using CHR(213), it would get transposed to some default character code
like 63, which obviously would corrupt the string so it could not be
de-crypted using ASC(x), because it would not be the same value as the
original character it is suppose to be.

But, by using chrw(x) and Ascw(x), proper unique character are generated.

-John Cody

"Jon Skeet [C# MVP]" <skeet@pobox.com> wrote in message
news:MPG.1bd5f2dc35865c4498b68a@msnews.microsoft.com...
> John Cody <newsgroups@noospammmax-soft.com> wrote:
> > Thanks for the info about latin and cero. I ended up using chrW and ascW
to
> > properly use ascii codes 128-255 in strings on cero-based devices.
>
> That's a contradiction in terms. There *are* no correct ASCII codes
> 128-255. It's well worth getting clear exactly what is really what, in
> what character set etc.
>
> See http://www.pobox.com/~skeet/csharp/unicode.html for an explanation
> which might help.
>
> --
> Jon Skeet - <skeet@pobox.com>
> http://www.pobox.com/~skeet
> If replying to the group, please do not mail me too



Re: REWARD: chr() not working for Chinese "Locale" by Jon

Jon
Wed Oct 13 02:31:11 CDT 2004

John Cody <newsgroups@noospammmax-soft.com> wrote:
> Basically, I have a routine that encrypts a string. Each character of the
> resulting string can have a value of 0-255. It seems that with a "Latin"
> based character set, characters 128 to 255 are all unique, so no matter what
> value the encryption routine generated for each character, it was
> reversible - meaning the original string could be de-crypted back to its
> original value.

Urgh. That's a nasty idea. It may well work, but it's not at all nice.
Base64 is a much better way to convert what is essentially binary data
into a string which is likely to survive whatever you throw at it.

Actually, ISO-8859-1 sort of has a hole between 128 and 140 (or 160 -
can't remember now). (I used to disagree with this based on the Unicode
spec stating that the first 256 values of Unicode were the same as ISO-
8859-1, but now I'm not so sure. It's a shame that the spec itself
costs money...) What you're probably referring to is something like
Code Page 1252, which is the same as ISO-8859-1 for every value other
than the "hole".

> However, it appears that when a "cero" character set is used, there are a
> lot of invalid/duplicate characters in the 128-255 range, so when the
> encryption routine tries to set a character to a value in this range, say
> 213 using CHR(213), it would get transposed to some default character code
> like 63, which obviously would corrupt the string so it could not be
> de-crypted using ASC(x), because it would not be the same value as the
> original character it is suppose to be.
>
> But, by using chrw(x) and Ascw(x), proper unique character are
> generated.

It's still basically a bad idea to keep binary data as a string like
that though. Base64 encoding is easy and doesn't add *very* much bulk
to the data.

--
Jon Skeet - <skeet@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too

Re: REWARD: chr() not working for Chinese "Locale" by John

John
Fri Oct 15 14:49:35 CDT 2004

Hey Jon,

I will try your pobox email address for the "thank you" reward.

-JC

"Jon Skeet [C# MVP]" <skeet@pobox.com> wrote in message
news:MPG.1bd6ea1ab048bc98b6a1@msnews.microsoft.com...
> John Cody <newsgroups@noospammmax-soft.com> wrote:
> > Basically, I have a routine that encrypts a string. Each character of
the
> > resulting string can have a value of 0-255. It seems that with a "Latin"
> > based character set, characters 128 to 255 are all unique, so no matter
what
> > value the encryption routine generated for each character, it was
> > reversible - meaning the original string could be de-crypted back to its
> > original value.
>
> Urgh. That's a nasty idea. It may well work, but it's not at all nice.
> Base64 is a much better way to convert what is essentially binary data
> into a string which is likely to survive whatever you throw at it.
>
> Actually, ISO-8859-1 sort of has a hole between 128 and 140 (or 160 -
> can't remember now). (I used to disagree with this based on the Unicode
> spec stating that the first 256 values of Unicode were the same as ISO-
> 8859-1, but now I'm not so sure. It's a shame that the spec itself
> costs money...) What you're probably referring to is something like
> Code Page 1252, which is the same as ISO-8859-1 for every value other
> than the "hole".
>
> > However, it appears that when a "cero" character set is used, there are
a
> > lot of invalid/duplicate characters in the 128-255 range, so when the
> > encryption routine tries to set a character to a value in this range,
say
> > 213 using CHR(213), it would get transposed to some default character
code
> > like 63, which obviously would corrupt the string so it could not be
> > de-crypted using ASC(x), because it would not be the same value as the
> > original character it is suppose to be.
> >
> > But, by using chrw(x) and Ascw(x), proper unique character are
> > generated.
>
> It's still basically a bad idea to keep binary data as a string like
> that though. Base64 encoding is easy and doesn't add *very* much bulk
> to the data.
>
> --
> Jon Skeet - <skeet@pobox.com>
> http://www.pobox.com/~skeet
> If replying to the group, please do not mail me too