Mike_D
(Mike D)
May 29, 2022, 12:42am
1
https://tracker.xojo.com/xojoinc/xojo/-/issues/68698
I recently upgraded from Xojo 2019 to Xojo 2022R1.1, and my app is showing a lot of warnings because FolderItem.ShellPath is now returning US-ASCII encoded strings.
Shouldn’t everything be UTF8 by now?
Tested in macOS 12.4
For codes less than 128, they are identical. What happens if you test with a path with a multi byte character in it?
Mike_D
(Mike D)
May 29, 2022, 1:35am
3
Good question, I will check.
Though if it does do this (return a different encoding for different files) I would consider that a bug, too.
It seems like a regression to me, and I know there was a lot of work done on FolderItem between 2019 and 2022, so I’m thinking it’s likely a bug.
Mike_D
(Mike D)
May 29, 2022, 1:48am
4
No, even files with names that should be UTF8 encoded are returned as US-ASCII. Defintely a bug.
FolderItem.name is UTF8 encoded, but FolderItem.ShellPath is US-ASCII (although the bytes are actually UTF-8)
Code to reproduce in 2022R1.1:
dim f as FolderItem = FolderItem.TemporaryFile
f = f.parent.child ("ümlaut")
messageBox "f.name = " + f.name + EndOfLine + "name.encoding= " + f.name.Encoding.InternetName + EndOfLine + "f.shellPath=" + f.ShellPath + EndOfLine + "encoding=" + f.shellPath.Encoding.InternetName
Mike_D
(Mike D)
May 29, 2022, 1:59am
5
A workaround:
function ShellPathNonBuggy(extends f as FolderItem) as String
dim s as string = f.ShellPath
if s.encoding <> Encodings.UTF8 then
s = s.defineEncoding(Encodings.UTF8)
end if
return s
end function