flat assembler
Message board for the users of flat assembler.

Index > Main > advanced ASCII

Author
Thread Post new topic Reply to topic
Mino



Joined: 14 Jan 2018
Posts: 163
Mino 04 Mar 2018, 21:04
Hello,
Does FASM allow advanced ASCII characters?
I tried this:
Code:
db "Chlo", 233, 0         ; "Chloé" is a French name
    

But I'm getting this:
Quote:

ChloÚ

A solution?
Thank you Smile

_________________
The best way to predict the future is to invent it.
Post 04 Mar 2018, 21:04
View user's profile Send private message Reply with quote
Furs



Joined: 04 Mar 2016
Posts: 2542
Furs 04 Mar 2018, 22:12
Well this has nothing to do with FASM, but with the print output, which is probably a setting in the OS (locale or whatever).

(and no, I don't know how to do that on the OS, only used English Razz)
Post 04 Mar 2018, 22:12
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20409
Location: In your JS exploiting you and your system
revolution 04 Mar 2018, 22:49
Mino wrote:
Does FASM allow advanced ASCII characters?
Yes. All 8-bit values except the reserved control characters are valid for names and strings. So all UNICODE code points can safely be encoded and assembled if your editor supports them. The hard part is how to print them, and that depends on what you code, what OS you use and where you are outputting the characters.
Post 04 Mar 2018, 22:49
View user's profile Send private message Visit poster's website Reply with quote
Walter



Joined: 26 Jan 2013
Posts: 155
Walter 04 Mar 2018, 22:57
If you're using printf, try using 130 instead of 233.

Code:

format pe console
entry start

include '\Fasm\Include\win32a.inc'

section '.data' data readable writeable

    msg     db "Chlo",130,0,13,10
    format1 db '%s',0

section '.code' code readable executable

    start:

        cinvoke printf,format1,msg
        invoke  ExitProcess,0

section '.idata' import data readable writeable

    library kernel32,'kernel32.dll',\
            crtdll,'crtdll.dll'

    import kernel32,\
           ExitProcess,'ExitProcess'

    import crtdll,\
           printf,'printf'                               
    


Image
Post 04 Mar 2018, 22:57
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20409
Location: In your JS exploiting you and your system
revolution 04 Mar 2018, 23:03
The code page selected determines which characters are mapped in the range 0x80-0xff.

If your OS/system supports UNICODE then that might be the easiest and most compatible encoding to select. That way all applications and OS components will agree on what characters to draw.
Post 04 Mar 2018, 23:03
View user's profile Send private message Visit poster's website Reply with quote
alexfru



Joined: 23 Mar 2014
Posts: 80
alexfru 05 Mar 2018, 06:04
Walter wrote:

Image


Actual interpretation of 8-bit character depends on the code page chosen in Windows. If I have the Russian code page, the characters will look different. One could chose the Unicode (UTF-8 ) page, but then non-ASCII chars will need several bytes per character and the cmd.exe window need to have a Unicode font selected (and unless anything has changed since Windows 7, a font can only be selected manually, oops).
Post 05 Mar 2018, 06:04
View user's profile Send private message Reply with quote
Mino



Joined: 14 Jan 2018
Posts: 163
Mino 05 Mar 2018, 16:50
Thank you very much for your answers Smile It works perfectly.
But, if I understood correctly, this technique (= mixing everything you've said) depends on the operating system; so if I'm on Windows, Mac or Linux, the result won't necessarily be the same?
Post 05 Mar 2018, 16:50
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20409
Location: In your JS exploiting you and your system
revolution 05 Mar 2018, 22:34
Mino wrote:
But, if I understood correctly, this technique (= mixing everything you've said) depends on the operating system; so if I'm on Windows, Mac or Linux, the result won't necessarily be the same?
Not just the OS, but the code page selection.

You will find UNICODE to be the most compatible across all OSes and programs. And specifically the UTF8 encoding of UNICODE. Everything else with code pages and only 256 characters is going to cause problems.
Post 05 Mar 2018, 22:34
View user's profile Send private message Visit poster's website Reply with quote
Mino



Joined: 14 Jan 2018
Posts: 163
Mino 06 Mar 2018, 15:27
Ok, thank you very much for yours answers Smile
Post 06 Mar 2018, 15:27
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.