News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Unicode in Quick Editor?

Started by Gunnar Vestergaard, December 14, 2009, 09:45:26 PM

Previous topic - Next topic

Gunnar Vestergaard

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?

dedndave

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

hutch--

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.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

jj2007

Gunnar,
Go to the old 2x site 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 ;-)

jj2007

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 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??

akane

You need to call DialogBoxParamW to get it workig. Tested on german XP with unicode .rc compiled with latest gorc.

jj2007

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).

dedndave

question - or maybe an answer for you, Jochen
don't some languages require the language pack to be installed ?

jj2007

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?

dedndave

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

jj2007

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

dedndave

oh - some of that looks like Arabic

hutch--

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.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

jj2007

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

hutch--

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
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php