From: Henryk Birecki on
I am trying to get number input from a CEdit window using DDX_Text.
Everything works fine if I am using Western script. However if I go to
Japanese ... things fall apart. This happens both on a PC and on a
PocketPC emulator with Japanese image loaded into it.

Basically what happens is that if I enter (e.g.) 2 in the CEdit
window, it is written there with character 65298 (255*256+18) instead
of character 50. DDX_Text uses wcstol to convert the number and fails.
I would somewhat understand this on a PC, but not on the WinMobile5
emulator. I do not have Japanese devices to test with, but this must
be something that others had encountered before. How does one get
around this problem short of writing one's own DDX. In the latter case
how does one know which characters are numbers in various scripts?

Any insight appreciated.
Henryk Birecki
From: Michael S. Kaplan [MSFT] on
That is not how numbers do their work across locales.

if you want to go from numbers to code points that put the numbers to text,
there are other ways. What kind of numbers did you want for Japanese?


--

MichKa [Microsoft]
Fundamentals Technical Lead
Windows International
Blog: http://blogs.msdn.com/michkap

This posting is provided "AS IS" with
no warranties, and confers no rights.


"Henryk Birecki" <soaringpilot(a)sbcglobal.net> wrote in message
news:bae7q3hrbl5bcngmm77hv50ka31dn3c7v8(a)4ax.com...
>I am trying to get number input from a CEdit window using DDX_Text.
> Everything works fine if I am using Western script. However if I go to
> Japanese ... things fall apart. This happens both on a PC and on a
> PocketPC emulator with Japanese image loaded into it.
>
> Basically what happens is that if I enter (e.g.) 2 in the CEdit
> window, it is written there with character 65298 (255*256+18) instead
> of character 50. DDX_Text uses wcstol to convert the number and fails.
> I would somewhat understand this on a PC, but not on the WinMobile5
> emulator. I do not have Japanese devices to test with, but this must
> be something that others had encountered before. How does one get
> around this problem short of writing one's own DDX. In the latter case
> how does one know which characters are numbers in various scripts?
>
> Any insight appreciated.
> Henryk Birecki


From: Henryk Birecki on
David Lowndes <DavidL(a)example.invalid> wrote:

>>> Basically what happens is that if I enter (e.g.) 2 in the CEdit
>>> window, it is written there with character 65298 (255*256+18) instead
>>> of character 50. DDX_Text uses wcstol to convert the number and fails.
>>
>>This is such a widespread problem, that I don't think any Japanese
>>user expects this to work.
>
>Out of interest, could you briefly explain why it does what it does -
>are numerical characters not the same values in Japanese?
>

I did some "research" on Unicode yesterday. I must admit that I know
nothing about locales, language specific strings.... Talk to me about
instrument control :). It appears that at least for Japanese there are
two versions of ASCII characters fullwidth (which is what appears in
my CEdit boxes after doing keyboard input) and halfwidth (?? I assume
that this is what the standard <128 characters are). From what I know
of Japanese it has to do with how much space written characters take
up on a page. Many of halfwidth characters are used somewhat as
subscripts so modify reading of main character. It somewhat makes
sense for the full width characters to be used for visualizetion. I am
just surprised that MS DDX routines do not do proper conversion. I am
also worried that this can come to bite in other cases. For now I just
wrote my own DDX routines to shift fullwidth ASCII to the "standard"
range.

Cheers,
Henryk

From: Henryk Birecki on
"Michael S. Kaplan [MSFT]" <michka(a)online.microsoft.com> wrote:

>That is not how numbers do their work across locales.
>
>if you want to go from numbers to code points that put the numbers to text,
>there are other ways. What kind of numbers did you want for Japanese?

Very simple. I want standard numeric input ( like 12.34 ) in a CEdit
box put there by keyboard (SIP), and then translate it to a numeric
(float in this case) value.

Henryk Birecki