Recent Posts

Pages: [1] 2 3 ... 10
1
The Campus / Re: Unicode literals
« Last post by jj2007 on Today at 11:23:55 AM »
@jj2007,

how is the source file encoded, UTF16 or UTF8, with or without BOM, and what assembler do you use?

UTF8, no BOM, Masm (6.15 and higher) or UAsm (recommended) or AsmC
2
The Campus / Re: Unicode literals
« Last post by Mikl__ on Today at 11:11:00 AM »
Hi, JK!
It was my first post in masm32 forum "Ansii and unicode strings" I use macro "du" which allows to display latin and cyrillic letters as unicode characters
Code: [Select]
du macro string
local bslash
bslash = 0
irpc c,<string>
if bslash eq 0
if '&c' eq "/"
        bslash = 1
elseif '&c'gt 127
db ('&c'- 0B0h),4
else
dw '&c'
endif
else
           bslash = 0
           if '&c' eq "n"
           DW 0Dh,0Ah
           elseif '&c' eq "/"
           dw '/'
           elseif '&c' eq "r"
           dw 0Dh
           elseif '&c' eq "l"
           dw 0Ah
           elseif '&c' eq "s"
           dw 20h
           elseif '&c' eq "c"
           dw 3Bh
           elseif '&c' eq "t"
           dw 9
   endif
endif
endm
dw 0
endm
for example
Code: [Select]
wHello: du <Hello, world>
wRusstring: du <фывап>
3
The Campus / Re: Unicode literals
« Last post by vitsoft on Today at 09:06:20 AM »
The information the assembler needs is the code page of the string (UTF8 in this case):

    asmc64 -ws65001 test.asm
...
include winnls.inc
    option codepage:CP_UTF8

I have thought that nidud talks about MASM, sorry.

4
The Campus / Re: Unicode literals
« Last post by JK on Today at 09:01:13 AM »
Quote
This is done in MASM with  option codepage:CP_UTF8

???, i cannot find an option "codepage" at Microsoft´s MASM pages (https://docs.microsoft.com/en-us/cpp/assembler/masm/option-masm?view=vs-2019)


JK

5
The Campus / Re: Unicode literals
« Last post by JK on Today at 08:47:14 AM »
thanks nidud,

i see now, the code file for asmc can be UTF8 and by telling asmc that it is UTF8 encoded, all literals are converted to UTF16 in the generated code. So no need for extra macros or functions for UTF8 to UTF16 conversion, it´s built in into asmc.


JK
6
The Campus / Re: Unicode literals
« Last post by vitsoft on Today at 08:38:41 AM »
how is the source file encoded, UTF16 or UTF8, with or without BOM, and what assembler do you use?

I faced similar challenge, source code should be written in UTF-8 without BOM and it will be emitted in wide (UTF-16) encoding, if the assembler is told which source encoding is used. This is done in MASM with  option codepage:CP_UTF8 and in €ASM with option EUROASM CodePage=UTF-8, see an example at https://euroassembler.eu/prowin64/cpmix64.htm
7
The Campus / Re: Unicode literals
« Last post by nidud on Today at 05:39:41 AM »
my post wasn´t clear enough, of course there is an ASCII codepage with Russian characters. But dealing with codepages is what i wanted to avoid, jj2007´s example demonstrates much better what i meant.

All operating systems use a code page so there's no way around that. The temporary page normally used for Unicode text is UTF8. This needs to be converted to UTF16 and that is what support means. Without this you end up adding code in order to convert the string.

include stdio.inc

   wprintf( "фывап\n" )

The information the assembler needs is the code page of the string (UTF8 in this case):

    asmc64 -ws65001 test.asm
...
include winnls.inc
    option codepage:CP_UTF8

These options are basically arguments to MultiByteToWideChar() so the code produced is the translated string.

        lea     rcx, [DS0000]
        call    wprintf     

DS0000  label byte
        db 44H, 04H, 4BH, 04H, 32H, 04H, 30H, 04H
        db 3FH, 04H, 0AH, 00H, 00H, 00H         
8
The Campus / Re: Unicode literals
« Last post by JK on Today at 04:04:11 AM »
Thanks for your replies.

@nidud,

my post wasn´t clear enough, of course there is an ASCII codepage with Russian characters. But dealing with codepages is what i wanted to avoid, jj2007´s example demonstrates much better what i meant.

@jj2007,

how is the source file encoded, UTF16 or UTF8, with or without BOM, and what assembler do you use?


JK
9
Romper Room / Re: antivirus recommendation wanted
« Last post by caballero on Today at 03:14:52 AM »
SEAT (car manufacturer) focuses on manufacturing respirators with the adapted motor of the windscreen wiper.

https://youtu.be/BT8dWtS-v5M
10
Romper Room / Re: The Plan To Save The World
« Last post by HSE on Today at 03:05:28 AM »
 Really captures attention until they say that Trump is not part of that  :biggrin: :biggrin: :biggrin:

Pages: [1] 2 3 ... 10