I think will be good if assembler understands unicode text files instead of only ascii text files, this way you don't touch on this problem.
If user like to use unicode strings on source code so will save as unicode file, if like to deal with ascii files will save as ascii text. Text editor will do these transformation to you (us).
;--- "hello world" for 64-bit Linux, using SYSCALL and SYSVCALL convention.
;--- assemble: HJWasm -elf64 -Fo=Lin64_2.o Lin64_2.asm
;--- link: gcc Lin64_2.o -o Lin64_2
;--- ld -o Lin64_2 -dynamic-linker /lib64/l4.so.2 /usr/lib/x86_64-linux-gnu/crt1.o /usr/lib/x86_64-linux-gnu/crti.o -lc Lin64_2.o /usr/lib/x86_64-linux-gnu/crtn.o
stdout equ 1
SYS_WRITE equ 1
SYS_EXIT equ 60
WriteToConsole PROTO SYSTEMV pString:PTR, strLen:DWORD, outHandle:DWORD
.data
aMsg db 10,"This source file was saved using utf8 encode!",10,0
bMsg db "An utf8 string: 䌣吲敃ሴ癔蝥⍅⍧㑖",10,0
.code
main PROC SYSTEMV
invoke WriteToConsole, ADDR aMsg, sizeof aMsg, stdout
invoke WriteToConsole, ADDR bMsg, sizeof bMsg, stdout
invoke WriteToConsole,"é⍅ሴ⍅\n",2+3+3+3+1,stdout
mov eax, SYS_EXIT
syscall
ret
main ENDP
WriteToConsole PROC SYSTEMV pString:PTR, strLen:DWORD, outHandle:DWORD
LOCAL handle:DWORD
mov handle, outHandle ; this is allowed as outHandle evaluates as a register operand.
mov edx, strLen
mov rsi, pString
mov edi, handle
mov eax, SYS_WRITE
syscall
ret
WriteToConsole ENDP
end
mineiro@assembly:~/Documentos/hasm/hasm231_linux64/Samples$ ./hasm -elf64 -Fo=Lin64_2.o Lin64_2.asm
Hasm v2.31, May 15 2017, Masm-compatible assembler.
Portions Copyright (c) 1992-2002 Sybase, Inc. All Rights Reserved.
Source code is available under the Sybase Open Watcom Public License.
Lin64_2.asm: 41 lines, 3 passes, 1947 ms, 0 warnings, 0 errors
mineiro@assembly:~/Documentos/hasm/hasm231_linux64/Samples$ gcc Lin64_2.o -o lin64_2
mineiro@assembly:~/Documentos/hasm/hasm231_linux64/Samples$ ./lin64_2
This source file was saved using utf8 encode!
An utf8 string: 䌣吲敃ሴ癔蝥⍅⍧㑖
é⍅ሴ⍅
mineiro@assembly:~/Documentos/hasm/hasm231_linux64/Samples$