News:

Download Pelles C here: http://www.smorgasbordet.com/pellesc/

Main Menu

Recent posts

#1
Assembly discussions / Re: Unicode strings in Assembl...
Last post by LeraUnu - Yesterday at 06:08:53 PM
Hi Pelle,

Thank you!
#2
Assembly discussions / Re: Unicode strings in Assembl...
Last post by Pelle - Yesterday at 10:17:52 AM
The exact encoding of strings in DW and DB directives has always been a bit fuzzy, and very dependent on the internal POASM format (and MASM has never been very helpful in this area).

Now with the internal format in POASM being more strictly UTF-8, the best for DW directives is probably to add a proper translation from UTF-8 to UTF-16. I will do that.

I'm less sure about DB directives. Right now it happens to be UTF-8 - which is better than ASCII, and probably better than "ANSI", but not completely clear. Thoughts?

EDIT: the help file says "ANSI" for the DB directive, so maybe that for compatibility. I'm not sure MASM can/will handle any letters beyond A-Z, which is really the same in ASCII/ANSI/UTF-8.
#3
Assembly discussions / Re: Unicode strings in Assembl...
Last post by LeraUnu - July 06, 2025, 01:29:26 PM
Hi Michele,
QuoteIt seems that the assembler doesnt' encode properly the unicode text strings.
Replacing the special unicode characters with their respective hex values it works
Yes I think that ...

Hi Vortex,
Quotemsg   dw 'This a UNICODE test '
      INCBIN "UnicodeText.txt"
      dw 0
Nice trick!

I hope that Pelle will fix the diacritics encoding in POASM in the future.

Thank you all for your kind help!

P.S.
I attach here the unicode version of Vortex's "SimpleWnd32" example with some diacritics and INCBIN.
#4
Assembly discussions / Re: Unicode strings in Assembl...
Last post by Vortex - July 06, 2025, 12:28:15 PM
Hi LeraUnu and Michele,

Thanks for your tests. Here is a practical solution, a workaround with Poasm's statement INCBIN :

.386
.model flat,stdcall
option casemap:none

MessageBoxW PROTO :DWORD,:DWORD,:DWORD,:DWORD
MessageBox TEXTEQU <MessageBoxW>

ExitProcess PROTO :DWORD
.data

title dw 'UnicodeTest',0
msg   dw 'This a UNICODE test '
      INCBIN "UnicodeText.txt"
      dw 0

.code

start:

      invoke MessageBox,0,ADDR msg,ADDR title,0
      invoke ExitProcess,0

END start

UnicodeText.txt :

ă î ș ț
#5
Assembly discussions / Re: Unicode strings in Assembl...
Last post by Michele - July 05, 2025, 09:10:38 PM
Quote from: Vortex on July 05, 2025, 12:06:24 PMHi LeraUnu,

Thanks, your example works fine but my Poasm test is always failing.

- What is the version of your Pelles C setup? Mine is 13
- What's the encoding of your Pelles C editor? Mine is UTF16-LE

Could you check the attachment? I guess my source file cannot correctly encode those special characters.

It seems that the assembler doesnt' encode properly the unicode text strings.
Replacing the special unicode characters with their respective hex values it works.
#6
Assembly discussions / Re: Unicode strings in Assembl...
Last post by LeraUnu - July 05, 2025, 06:06:06 PM
Hi Vortex,

Thank you for testing.

PellesC version = 13
Encoding = UTF-16LE

I attach a text file with the Romanian characters and a modified object file (manually)
#7
Assembly discussions / Re: Unicode strings in Assembl...
Last post by Vortex - July 05, 2025, 12:06:24 PM
Hi LeraUnu,

Thanks, your example works fine but my Poasm test is always failing.

- What is the version of your Pelles C setup? Mine is 13
- What's the encoding of your Pelles C editor? Mine is UTF16-LE

Could you check the attachment? I guess my source file cannot correctly encode those special characters.
#8
Assembly discussions / Re: Unicode strings in Assembl...
Last post by LeraUnu - July 05, 2025, 07:27:51 AM
Hi Vortex,

Here is a small C project test. Please have a look.
#9
Assembly discussions / Re: Unicode strings in Assembl...
Last post by TimoVJL - July 04, 2025, 04:01:14 PM
I just analyzed things with pope.exe and TLPEView.exe
Just checking object file .data section, something is really wrong.
So use those tools to check how things went.
#10
Assembly discussions / Re: Unicode strings in Assembl...
Last post by Vortex - July 04, 2025, 03:27:32 PM
Hello LeraUnu,

Quoteset the encoding of the source files to UTF-16LE and everything is ok.

That didn't work for me. Tested with PellesC V13. I receive the uncorrect text display.