The MASM Forum Archive 2004 to 2012

General Forums => The Laboratory => Topic started by: Gunnar Vestergaard on December 14, 2009, 09:45:26 PM

Title: Unicode in Quick Editor?
Post by: Gunnar Vestergaard on December 14, 2009, 09:45:26 PM
Does Steve Hutchesson's Quick Editor 4.0 support Unicode? I ask because we live in a world that increasingly wants to get together and work together.

So, if I were to publish a great application, many users from around the world possibly would offer to internationalize my application into their native language.

I can imagine a solution where I use Quick Editor only for assembly code and then another editor for internationalized strings that get included into the main assembly source. UTF-8 is compatible with ASCII and Codepage 1252 in that code points in Unicode that have a value lower than 128 are identical to ASCII. That way I could have internationalized strings in a separate file and if that file is encoded in UTF-8 it should be very easy to include that into the main assembly program.

Any thoughts on this? I mean, would it be a great idea to modify Quick Editor so that it supports Unicode?
Title: Re: Unicode in Quick Editor?
Post by: dedndave on December 14, 2009, 09:52:52 PM
i am not sure if QE does, Gunner - it would not surprise me if it does
thing is - you can put the unicode strings into a resource file
the end-user changes language, you switch resources, either by selecting a different file or different set of ordinals
Title: Re: Unicode in Quick Editor?
Post by: hutch-- on December 14, 2009, 10:52:14 PM
Gunnar,

QE is written specifically to write ANSI characters and it does this by specifying the ANSI functions and ANSI options with the API functions it uses. A unicode tool would be useful but could not write the specific bare ANSI that QE is designed to outout and this would destroy much of what it gets used for. Its internal functions are written around a single byte character set so a unicode version would be a complete rewrite, not a modification.

Interestingly enough, what would be useful is a unicode editor for editing resource files so that international characters sets including the east Asian ones could be edited by a variety of users from different language backgrounds.
Title: Re: Unicode in Quick Editor?
Post by: jj2007 on December 15, 2009, 12:10:52 AM
Gunnar,
Go to the old 2x site (http://netez.com/2xExplorer/) and search Unicode inside the page. There is an archive in the lower right corner. Works perfectly, and is free. Advanced Masm users may be able to use GetAsyncKeystate for adding the "Build all" key ;-)
Title: Re: Unicode in Quick Editor?
Post by: jj2007 on December 15, 2009, 10:23:48 PM
Quote from: Gunnar Vestergaard on December 14, 2009, 09:45:26 PM
I can imagine a solution where I use Quick Editor only for assembly code and then another editor for internationalized strings that get included into the main assembly source.

I have implemented this solution now in RichMasm, attached here (http://www.masm32.com/board/index.php?topic=12460.msg99426#msg99426) as MasmBasic9j.zip:
Quoteinclude \masm32\include\masm32rt.inc   ; adapted from \masm32\examples\exampl01\resdlg\resdlg.asm

WndProc PROTO :DWORD,:DWORD,:DWORD,:DWORD

.code
start:
        invoke GetModuleHandle, NULL
        invoke DialogBoxParam, eax, chr$("TestWin"), 0, ADDR WndProc, 0   ; Call the dialog box stored in resource file
        invoke ExitProcess,eax

WndProc proc hWin, uMsg, wParam, lParam
   .if uMsg == WM_INITDIALOG
      invoke SendMessage, hWin, WM_SETTEXT, 0, chr$("Demo dialog box")
   .elseif uMsg == WM_CLOSE
      invoke EndDialog, hWin, 0
   .endif
   xor eax, eax
   ret
WndProc endp
end start

Rsrc ------------------------------------------------------[/b]
#include "\masm32\include\resource.h"

TestWin DIALOGEX MOVEABLE IMPURE LOADONCALL DISCARDABLE   10, 10, 205, 122, 0
STYLE DS_MODALFRAME | 0x0004 | DS_CENTER | WS_CAPTION | WS_SYSMENU | WS_VISIBLE | WS_POPUP
CAPTION "Dialog"
FONT 8, "MS Sans Serif", 700, 0 /*FALSE*/
BEGIN
    EDITTEXT        100,    67,8,71,14, ES_AUTOHSCROLL | ES_LEFT, , 0
    EDITTEXT        101,    67,28,71,12, ES_AUTOHSCROLL | ES_LEFT, , 0
    EDITTEXT        102,    67,47,71,13, ES_AUTOHSCROLL | ES_LEFT, , 0
    EDITTEXT        103,    67,80,71,13, ES_AUTOHSCROLL | ES_LEFT, , 0
    PUSHBUTTON      "
БВГДЕЁЖЗИЙК", 1000, 66, 98, 35, 16, 0, , 0
    PUSHBUTTON      "Clear", 1001,    105,98,35,16, 0, , 0
    CTEXT           "Input A", 20,    11,10,43,10, SS_LEFT, , 0
    CTEXT           "Input B", 30,    11,29,43,10, SS_LEFT, , 0
    CTEXT           "Input C", 40,    11,48,43,10, SS_LEFT, , 0
    CTEXT           "Equals",  50,    13,81,43,9, SS_LEFT, , 0
END
Rsrc ------------------------------------------------------
[/b]

When hitting the F6 key, RichMasm exports the main code as plain text to a temporary *.asm file, generates a Unicode *.rc file from the text between the two Rsrc tags, and launches the assembly. The resulting exe works fine, but the Russian PUSHBUTTON displays as ??????. Does anybody have a clue how Unicode res strings are being applied correctly??
Title: Re: Unicode in Quick Editor?
Post by: akane on December 15, 2009, 10:50:31 PM
You need to call DialogBoxParamW to get it workig. Tested on german XP with unicode .rc compiled with latest gorc.
Title: Re: Unicode in Quick Editor?
Post by: jj2007 on December 15, 2009, 10:55:16 PM
I tested DialogBoxParamW, too. No success... the ordinary strings display fine (they are wide in the .rc file), but Russian or Arabic just yields question marks.

Full code attached (the *.asc opens in RichMasm, not needed here).
Title: Re: Unicode in Quick Editor?
Post by: dedndave on December 15, 2009, 11:08:24 PM
question - or maybe an answer for you, Jochen
don't some languages require the language pack to be installed ?
Title: Re: Unicode in Quick Editor?
Post by: jj2007 on December 15, 2009, 11:10:02 PM
Quote from: dedndave on December 15, 2009, 11:08:24 PM
question - or maybe an answer for you, Jochen
don't some languages require the language pack to be installed ?

In principle, yes. But if it wasn't installed, I wouldn't see the Arabic text in RichMasm, right?
Title: Re: Unicode in Quick Editor?
Post by: dedndave on December 15, 2009, 11:14:16 PM
well - i dunno
what i know about the Arabic language, you could scribble on the inside of a matchbook - and still have room to prepare your taxes
perhaps some characters will display in a rudimentary form
but - i see nothing on this page that looks like Arabic - lol
Chinese is even worse

i do see what looks like Russian - or some form of "Cryllic" text
"БВГДЕЁЖЗИЙК"
      ^  if that is viral code, Hutch - blame JJ   :P
Title: Re: Unicode in Quick Editor?
Post by: jj2007 on December 15, 2009, 11:20:16 PM
Quote from: dedndave on December 15, 2009, 11:14:16 PM
but - i see nothing on this page that looks like Arabic - lol
i do see what looks like Russian - or some form of "Crylic" text

I see both Russian and Arabic, in FireFox, in RichMasm, and in a plain text Unicode editor (2x). Only the dialog refuses to show them...
Quote    PUSHBUTTON      "БВГДЕЁЖЗИЙК", 1000, 66, 98, 35, 16, 0, , 0
    CTEXT           "
ما هي الشفرة الموحدة يونِكود ؟[/b]",  50,    13,81,43,9, SS_LEFT, , 0
Title: Re: Unicode in Quick Editor?
Post by: dedndave on December 15, 2009, 11:21:08 PM
oh - some of that looks like Arabic
Title: Re: Unicode in Quick Editor?
Post by: hutch-- on December 16, 2009, 12:27:46 AM
You would need to know the local conditions as per language format for some countries to know what fonts you need. As I have to read some sites in Chinese and Japanese I installed the "East Asia" fonts and it all works OK in a US English Windows version butr for example if you were using the Inuit version of XP and wanted to read the Patagonian dialect of Spanish you may need to add another characters set.

Its usually only a problem with completely different character sets like Arabic or Chinese as against European character sets.
Title: Re: Unicode in Quick Editor?
Post by: jj2007 on December 16, 2009, 07:30:41 AM
Hutch,
The fonts are not the problem - if they were not installed, I would not see them in a richedit control, right?
Since you are the one who is hammering that resource files are the way to go with Unicode, I had hoped you would be able to make the example attached above work...?
:thumbu
Title: Re: Unicode in Quick Editor?
Post by: hutch-- on December 16, 2009, 08:01:05 AM
An ANSI riched edit 2 control will display east asian fonts, you just cannot type them in or save them. First test for the problem was to see if he had the right fonts installed to display the character set he was after. next test if if you have a keyboard/input method to enter the text etc .....

> I had hoped you would be able to make the example attached above work...?

I only deliver on request for an hourly rate and thats only by agreement.  :bg
Title: Re: Unicode in Quick Editor?
Post by: Ghandi on December 16, 2009, 08:35:48 AM
The charset isnt 'just' char-null.. I've attached the PDF i found which outlines Cyrillic (they're hex values) and i've also attached a simple example (WinASM project) which uses the widestring variant of API to display a dialog and change its title text. It is worth noting though that i havent used the string in resources, instead hardcoding it into the data section with each char as a hexadecimal word.

With my system set to English (US) i get the Russian chars and with it set to Russian i get the same. I think if you were to use this approach, you would need to let the user set the language and then update the strings used by the application? Dunno, im pretty much agreeing with Dave, if my knowledge of the Russian language were dynamite, it wouldnt be enough to even mess my hair up.

HR,
Ghandi
Title: Re: Unicode in Quick Editor?
Post by: UtillMasm on December 16, 2009, 09:00:20 AM
i think WideChar is all character.
if you need display or input all the WideChar character, you need install all fonts.

Title: Re: Unicode in Quick Editor?
Post by: jj2007 on December 16, 2009, 09:33:33 AM
Quote from: hutch-- on December 16, 2009, 08:01:05 AM
An ANSI riched edit 2 control will display east asian fonts, you just cannot type them in or save them.

It displays Arabic and Russian, it saves Arabic and Russian, and the plain text Unicode file that RichMasm writes to the *.rc file contains Arabic and Russian, as can be verified by opening it in Ms Word.

And I am glad that I didn't hit the "Post" button right away, because I just relaunched the ResDlgMb.asm on my desktop and voilà, the bloody dialog displays Arabic and Russian...!!

Mysteries of Windows. On my notebook, everything displays Arabic except that dialog...

EDIT: One mystery solved. To display Arabic, check "Install files for complex script and right-to-left languages" in Control Panel, Regional and Language Options, Languages. The remaining mystery is why afterwards Russian becomes visible, too -  not exactly a "complex script" language, and written from left to right. Oh Bill, if you had to pay for every hour wasted due to poor documentation, you would be a poor man :green