I made a little NASM program that reads it's first command line argument and prints it out. It works well with ascii input: running "myfile hello" returns "argv = hello", but if input string contains special letters such as õ, ä, ö, ü , they will respectively be shown as §, õ, ÷, ³.
My current code is:
section .data
input dw `argv = %s\n` , 0
section .bss
section .text
global _main
extern _printf
_main:
push ebp
mov ebp,esp
push esi
mov esi, [ebp + 12]
mov ebx, 1
mov eax, [esi + ebx * 4]
push eax
push input
call _printf
pop esi
mov esp, ebp
pop ebp
ret
and is compiled as
nasm -f win32 myfile.asm -o myfile.obj
gcc -m32 myfile.obj -o myfile.exe
How can it be changed so that it will work with any type of input?
EDIT:
Thanks for the useful comments. Setting my terminal code page to 1252 did indeed solve my problem's example case. However, I am interested in more general solution. For example, I am still unable to print cyrillic characters freely.
I tried using unicode code page (65001), but it then ignores any non-ascii characters. Also tried to use code page 1251 directly. Then it could "translate" my õ,ä,ö,ü characters as Russian х,д,ц,ь; respectively. However inputting any actual Slavic letters will output just question marks. How can I solve it properly?