flat assembler
Message board for the users of flat assembler.
Index
> Windows > How do I print unicode string using printf Goto page Previous 1, 2 |
Author |
|
revolution 10 Jun 2023, 10:18
Your screenshot shows it working fine, with the only issue that your chosen font doesn't have the glyphs to render the characters. Those squares are what most font renderers will show when the glyph isn't found in the font.
Win7 could do this when you have the right font available, so I see no reason that Win10 can't. All you need to do is choose a different font with the glyphs you use. |
|||
10 Jun 2023, 10:18 |
|
moistMaven 11 Jun 2023, 10:36
Flier-Mate wrote: I use the same code that I posted above, but no luck seeing Hindi characters in my Windows 10 console. Setting the Code Pages inside of assembly works but not directly in console, I don't know why? Code: format PE console entry start include "win32a.inc" include "encoding\utf8.inc" section ".data" data readable writeable hindi du "हिन्दी",13,10,0 _len = $ - hindi section ".code" code executable readable start: ccall [SetConsoleOutputCP], 65001 push -11 call [GetStdHandle] push 0 push 0 push _len push hindi push eax call [WriteConsoleW] push 0 call [ExitProcess] ;==================================== section '.idata' import data readable ;==================================== library kernel,'kernel32.dll', msvcrt,'msvcrt.dll' import kernel, SetConsoleOutputCP, 'SetConsoleOutputCP', \ GetStdHandle, "GetStdHandle", \ WriteConsoleW, "WriteConsoleW", \ ExitProcess, "ExitProcess" import msvcrt, printf,'printf', getchar,'_fgetchar' |
|||
11 Jun 2023, 10:36 |
|
bitRAKE 11 Jun 2023, 12:36
Code: include "encoding\utf8.inc" Which is completely unrelated to SetConsoleOutputCP. Microsoft wrote: UTF-8 formatted text can be sent to the A family of console APIs after ensuring the code page is first set to 65001 (CP_UTF8) with the SetConsoleCP and SetConsoleOutputCP functions. Using include "encoding\utf8.inc" is not needed when using the A family of console APIs with UTF-8 encoding characters. They are mutually exclusive. Either one is sending bytes to the A family of console APIs with UTF-8 encoding characters, or one is sending WCHARs to the W family of console APIs. _________________ ¯\(°_o)/¯ “languages are not safe - uses can be” Bjarne Stroustrup |
|||
11 Jun 2023, 12:36 |
|
Goto page Previous 1, 2 < Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.