Code: Select all
DIM s AS STRING
DIM w as WSTRING * 16
w = "Hello"
s = w
w = s
print s
print w
Is this the same in Linux ( "wide string <-> ANSI"), or is the automatic conversion in Linux "wide string <-> UTF8" ?
JK
Code: Select all
DIM s AS STRING
DIM w as WSTRING * 16
w = "Hello"
s = w
w = s
print s
print w
Code: Select all
DIM s AS STRING
DIM w as WSTRING * 16
w = "H€llΩ"
s = w
w = s
print s, len(s)
print w, len(w)
As seen above len(String) contains 8 (UByte) while len(WString) contains 5 (UShort?),badidea wrote:Result:
H€llΩ 8
H€llΩ 5
Code: Select all
DIM s AS STRING
DIM w as WSTRING * 16
'w = "H€llΩ"
w = !"\u0048\u20ac\u006c\u006c\u03a9"
s = w
w = s
print s, len(s)
print w, len(w)
Code: Select all
DIM w AS WSTRING * 260 = "фыва.txt"
OPEN w FOR OUTPUT ENCODING "ascii" AS #1
PUT #1,,"test"
CLOSE #1
Note that it depends on distro, so it is not 100%. Be careful with embedded or old distros (like e.g. the linux on your NAS if you have access to it)MrSwiss wrote:As seen above len(String) contains 8 (UByte) while len(WString) contains 5 (UShort?),
which indicates, that *..IX* systems use UTF-8 (as standard) which is a very different
Windows 10 since 2 iterations (1803) hasn an option to make the 1-byte codepage utf8. It is still beta in fall release.system, looking at it from a DOS/WIN perspective (ASCII/ANSI) ...
Strictly speaking afaik the wchar_t size is platform dependent, but usually 4-bytes in practice. But that is because it isn't widely used as API string type , so the wchar_t is mostly only used for certain conversions and inside font rendering routines.(Btw. not certain, that WString on **ix isn't evtl. 32 bits (ULong) UTF-32)
unicode is now 25 years old or so. (first drafts early nineties). You can be arch conservative with 25 years old junk, and still support unicode :-)The only immutable part of all those systems is: 0 to 127, which isn't ever changed!
(as described in the lower half, of the ASCII-Table)