Not only in UEZ's computer, this happens in all computers if you save a file in Unicode format (UTF8 (BOM), UTF16 (BOM), UTF32 (BOM), ...).
Sorting output of Dir()
-
- Posts: 880
- Joined: Jul 26, 2018 18:28
Re: Sorting output of Dir()
Re: Sorting output of Dir()
Thank you Xusinboy Bekchanov for clarifying this issue.
I need to remember this for the future, that if the code is stored in UTF format, I use Str() or use text format to avoid problems and don't waste time in troubleshooting.
I need to remember this for the future, that if the code is stored in UTF format, I use Str() or use text format to avoid problems and don't waste time in troubleshooting.
-
- Posts: 880
- Joined: Jul 26, 2018 18:28
Re: Sorting output of Dir()
On the contrary, I need a unicode string and always include #define UNICODE before #include once "windows.bi". In my case, the Str function is not needed, because all WinAPI functions require WString string.
Re: Sorting output of Dir()
But not accepting var s="abc" say should not make "abc" wstr("abc") on some computers, it is surely a bug in this case.
Re: Sorting output of Dir()
Code: Select all
Var s1 = "FreeBASIC" '' ok
Var s2 = Str("FreeBASIC") '' ok
Var s3 = Wstr("FreeBASIC") '' error 24: Invalid data types in 'Var s3 = Wstr("FreeBASIC")'
-
- Posts: 880
- Joined: Jul 26, 2018 18:28
Re: Sorting output of Dir()
At the moment, the compiler has String (a dynamically resizing ANSI string) for ZString, but there is no UnicodeString or UString for WString yet, if this is added, then Var s = "қандай - what" will also be possible.
-
- Posts: 880
- Joined: Jul 26, 2018 18:28
Re: Sorting output of Dir()
You didn't check, I think, the example Var s1 = "FreeBASIC" with the UTF8 (BOM) file format.fxm wrote: ↑Apr 13, 2025 9:21Code: Select all
Var s1 = "FreeBASIC" '' ok Var s2 = Str("FreeBASIC") '' ok Var s3 = Wstr("FreeBASIC") '' error 24: Invalid data types in 'Var s3 = Wstr("FreeBASIC")'
Re: Sorting output of Dir()
Yes.Xusinboy Bekchanov wrote: ↑Apr 13, 2025 9:47You didn't check, I think, the example Var s1 = "FreeBASIC" with the UTF8 (BOM) file format.fxm wrote: ↑Apr 13, 2025 9:21Code: Select all
Var s1 = "FreeBASIC" '' ok Var s2 = Str("FreeBASIC") '' ok Var s3 = Wstr("FreeBASIC") '' error 24: Invalid data types in 'Var s3 = Wstr("FreeBASIC")'
Re: Sorting output of Dir()
Code: Select all
#print typeof("literal string")
ZSTRING * 15
Shouldn't all computers get this message (i.e. a zstring) in the comiler message window?
-
- Posts: 880
- Joined: Jul 26, 2018 18:28
Re: Sorting output of Dir()
If you make the source file format ANSI then: ZSTRING * 15dodicat wrote: ↑Apr 14, 2025 10:17I getCode: Select all
#print typeof("literal string")
ZSTRING * 15
Shouldn't all computers get this message (i.e. a zstring) in the comiler message window?
If you make the source file format UTF8 (BOM) then: WSTRING * 15
Re: Sorting output of Dir()
I added a bom, should be wstring now for literal strings under var, with the compile error at line 3 accordingly.
Thanks for explaining - everybody.
Thanks for explaining - everybody.
Code: Select all

var k="hi"
print k
#print typeof("literal string")
Sleep
sleep
-
- Posts: 880
- Joined: Jul 26, 2018 18:28
Re: Sorting output of Dir()
Maybe your IDE does not support UTF8 (BOM), try compiling using command line.dodicat wrote: ↑Apr 15, 2025 8:05 I added a bom, should be wstring now for literal strings under var, with the compile error at line 3 accordingly.
Thanks for explaining - everybody.
Code: Select all
 var k="hi" print k #print typeof("literal string") Sleep sleep
Re: Sorting output of Dir()
By adding the BOM to the .bas file, as I have done, the file is UTF8 (BOM).
I can compile via command line or fbide (my choice of ide), and a literal string will be a wstring * (some size).
Thus It will error on var s="some string".
So as UEZ says, there is a bug, (an inconsistency under var).
Or maybe you get a different compile error?
I get
FBIDETEMP.bas(3) error 24: Invalid data types
I can compile via command line or fbide (my choice of ide), and a literal string will be a wstring * (some size).
Thus It will error on var s="some string".
So as UEZ says, there is a bug, (an inconsistency under var).
Or maybe you get a different compile error?
I get
FBIDETEMP.bas(3) error 24: Invalid data types
Re: Sorting output of Dir()
This is not a bug but rather a deficiency well-specified in the documentation:
Otherwise this below compiles:
Note: Wstring is not supported with Var, due to the fact that there is no var-len Wstring type. This isn't likely to change, due to the complexities involved with handling Unicode.
Otherwise this below compiles:
Code: Select all

var k=Str("hi")
print k
#print typeof("literal string")
sleep
Code: Select all
hi
Code: Select all
WSTRING * 15
Re: Sorting output of Dir()
I think that you still might use fbide fxm, with the console open (you don't usually sleep at the end)
What does UEZ use these days, to automatically load .bas files as a utf-8 with BOM?
I think that automatically making all literal strings wstring might produce some more strange results. Who knows?
What does UEZ use these days, to automatically load .bas files as a utf-8 with BOM?
I think that automatically making all literal strings wstring might produce some more strange results. Who knows?