News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

trouble in unicode

Started by asmcoder, December 26, 2013, 12:33:42 PM

Previous topic - Next topic

asmcoder

Hello everyone,
I have a trouble when using unicode.
My system is Chinese Simplified (Mainland China) , the program attached works fine.
But when I run the program in Chinese traditional (HongKong, TaiWan...) system , something unexpected happened.

i use the same unicode text to show in a msgbox and the dialog title.
the msgbox works fine.
but the  dialog title has some "?"

MichaelW

What happens if you create the dialog with the Unicode version of the DialogBoxParam function?
Well Microsoft, here's another nice mess you've gotten us into.

dedndave

it's not a UNICODE window
i am surprised you got as far as you did

in the t2.asm file, comment out these lines
;.386
;.model flat, stdcall  ;32 bit memory model
;option casemap :none  ;case sensitive

include t2.inc


in the t2.inc file.....
__UNICODE__ EQU 1

include \masm32\include\masm32rt.inc
;include windows.inc
;include kernel32.inc
;include user32.inc
;include Comctl32.inc
;include shell32.inc

;includelib kernel32.lib
;includelib user32.lib
;includelib Comctl32.lib
;includelib shell32.lib

include String.inc


i can't tell if it works, because i don't have Traditional Chinese installed

asmcoder

i debug it with olly, found that __UNICODE__ don't work, still generate DialogBoxParamA

when i manually type DialogBoxParamW, the unicode text works

asmcoder

maybe my masm version is not 11 , i'll download it and try later.

MichaelW

Well Microsoft, here's another nice mess you've gotten us into.

jj2007

t2Dlg.rc is missing in your archive above.

In case you have MasmBasic, attached a little test. I guess it's simplified Chinese.

asmcoder

Quote from: jj2007 on December 26, 2013, 07:13:28 PM
t2Dlg.rc is missing in your archive above.

In case you have MasmBasic, attached a little test. I guess it's simplified Chinese.

Thanks jj
t2Dlg.rc is in the Res folder.  i created the project using radasm2. 



After download masm11, use __UNICODE__  ,the problem solved.

white

#8
how to define a unicode string has chinese words? sorry my english is poor

how to define a unicode string has chinese words? sorry my english is poor

I edited this because it was displaying in Chinese characters.

hutch--

White,

There are a couple of ways to display Chinese characters in MASM, normally source code for MASM must be written in ordinary ASCII characters but you can create an RC file in UNICODE where you can directly enter any UNICODE character including Chinese characters as resource strings. The other way is to make sequences in the .DATA section using the WORD data size (16 bit) and type the numbers for the UNICODE characters as an array of WORD size data elements.

jj2007

With MasmBasic's RichMasm editor, you can even type your Unicode strings directly into the source, and display them using the wRes$() macro (when hitting F6, the editor exports the part between the two Rsrc marks to filename.rc, then builds the project):

asmcoder

Hi, white.
you can download my attached files.
see string.inc

you can use $CTW0 ,  $TW0  , CCOUNTED_UNICODE_STRING  to define any unicode string, including Chinese

but you can not directly write Chinese in the source code, you need to write a translate program like this:



then
invoke MessageBoxW,0,$CTW0("\u4F60h\u597Dh\uFF0Ch\u6211h\u6765h\u81EAh\u4E2Dh\u56FDh\u0020h\u0068h\u0065h\u006Ch\u006Ch\u006Fh\u002Ch\u0069h\u0027h\u006Dh\u0020h\u0066h\u0072h\u006Fh\u006Dh\u0020h\u0043h\u0068h\u0069h\u006Eh\u0061h\u002Eh"),0,0

of course the english words need not to translate, also you can
invoke MessageBoxW,0,$CTW0("\u4F60h\u597Dh\uFF0Ch\u6211h\u6765h\u81EAh\u4E2Dh\u56FDh hello,i'm from China."),0,0

that means you can mix them