cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

ActiveX, Jscript and unicode

ActiveX, Jscript and unicode

Hello Adepters,

here is a very specific and tricky problem.

One of my collegue have written an ActiveX object which purpose is to populate data from a Mainframe/Adabas through EntireX in a DOM object.

This ActiveX object is written in VB and has been compiled under Windows NTsp4.

My application is made of an Epic 5.1M Editor window with a docked XUI and run under Windows 2000sp4 with japanese locale.

The controller part is written in JScript because it was first written in JavaScript and then the need to use our ActiveX object occured.

I use range.insertParsedString(mystring) to insert data from the ActiveX object in my document and XUI DOM.

The problem is that unicode characters over 127 are not properly displayed.

For debug purpose, I have modified my code to write non-ASCII character as [unicode number] string.

If I take this string as an example: "Les équipements électriques"

1) if the string is UTF-16 encoded on the ActiveX side.
Then the result in Epic is:
"UndefinedLes [39410]uipements [39384]ectriques"

2) if the string is UTF-8 encoded on the ActiveX side.
Then the result in Epic is:
"Undefinedes[39719][56394]uipements [39719][33031]ectriques"

Note:
a) the presence of "Undefined" word starting both case
b) the character following "é" disappear in both case
c) the fake unicode number is different for each occurence of "é" (obviously some kind of combination of "é" and the following)
d) The initial "L" disappear in case 2

Any idea ?

Olivier.





------
World Intellectual Property Organization Disclaimer:

This electronic message may contain privileged, confidential and
copyright protected information. If you have received this e-mail
by mistake, please immediately notify the sender and delete this
e-mail and all its attachments. Please ensure all e-mail attachments
are scanned for viruses prior to opening or using.
Tags (2)
7 REPLIES 7
Highlighted

RE: ActiveX, Jscript and unicode

Hi Olivier--

This is just a wild stab, but have you tried creating text nodes directly instead of using insertParsedString()? Maybe something like this would work better:

t = dlgdoc.createTextNode(myActiveXcontrol.SomeField);
textbox.appendChild(t);

FWIW, the "undefined" string usually results from a reference to a javascript variable that has not been initialized. Maybe you're concatenating two field values, where there's some kind of problem resolving the first field value, resulting in the "undefined".

--Clay
Highlighted

RE: ActiveX, Jscript and unicode

Hi Clay,

createTextNode does not help.

Its lokk like the ActiveX is not properly handling Unicode under a japanese locale (it is OK under an english locale).

You are right concerning "undefined", it is fixed now.

Thank you.

Olivier.

>>> chelberg@spss.com 17/11/05 3:03:54 PM >>>
Hi Olivier--

This is just a wild stab, but have you tried creating text nodes directly instead of using insertParsedString()? Maybe something like this would work better:

t = dlgdoc.createTextNode(myActiveXcontrol.SomeField);
textbox.appendChild(t);

FWIW, the "undefined" string usually results from a reference to a javascript variable that has not been initialized. Maybe you're concatenating two field values, where there's some kind of problem resolving the first field value, resulting in the "undefined".

--Clay
Highlighted

Re: ActiveX, Jscript and unicode

Pardon if this is way off, but I've been able to output non-ascii
characters in XUI dialogs (I'm not sure if you're embedding activex)
by setting the family attribute on the relevant xui node to "Unicode".
I believe I also had to set the character programatically as well,
but I could be mistaken on that part.

keith


Highlighted

Re: ActiveX, Jscript and unicode

Your utf-16 examples seem to make sense.

In the example:

"UndefinedLes [39410]uipements [39384]ectriques"

39410 in unicode translates to E971 in Shift-JIS. Going back, E9 is
é and 71 is q.
likewise
39384 in unicode translates to E96C in Shift-JIS. Going back, E9 is é
and 6C is l.
Highlighted

Re: ActiveX, Jscript and unicode

Keith,

thanks a lot !

Do you think that it is possible to write a formula to retrieve the Shift-JIS hex code from the decimal number I get ?

Or do I have to find some kind of map ?

Olivier.

>>> keith.berard@milliman.com 17/11/05 6:31:29 PM >>>
Your utf-16 examples seem to make sense.

In the example:

"UndefinedLes [39410]uipements [39384]ectriques"

39410 in unicode translates to E971 in Shift-JIS. Going back, E9 is
é and 71 is q.
likewise
39384 in unicode translates to E96C in Shift-JIS. Going back, E9 is é
and 6C is l.
Highlighted

RE: ActiveX, Jscript and unicode

Olivier,
I don't know much about the relationship between Shift-JIS and Unicode, but I don't think there is any formula to reliably convert between them. However, the Unicode consortium publishes a mapping between them at:
Highlighted

RE: ActiveX, Jscript and unicode

Hello,

the solution is to migrate to XP, all is OK now.

Olivier.

>>> - 18/11/05 9:18:16 PM >>>
Olivier,
I don't know much about the relationship between Shift-JIS and Unicode, but I don't think there is any formula to reliably convert between them. However, the Unicode consortium publishes a mapping between them at:
Announcements