FolderItem.ShellPath returns US-ASCII encoded string

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?

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.

No, even files with names that should be UTF8 encoded are returned as US-ASCII. Defintely a bug. 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 " = " + + EndOfLine + "name.encoding= " + + EndOfLine + "f.shellPath=" + f.ShellPath + EndOfLine + "encoding=" + f.shellPath.Encoding.InternetName

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