I have been searching on the web for quite some time now but I haven’t found a solution to my problem. I have a GetFolderItem with a few childs:
[code]Dim f As FolderItem
Dim p As Picture
f = GetFolderItem("").Parent.Child(dirPictures).Child(dirSmall).Child(Small_Logo)
p = f.openAsPicture
pic1.Backdrop = p
pic1.Visible = True[/code]
Whenever there is an umlaut within the GetFolderItem(""), for example “C:\Persönlich”, it doesn’t work because of the umlaut. How do I get rid of the umlaut in that case without changing the directory name?
[quote=354864:@Christian Schmitz]@Eli Ott not ConvertEmcoding.
Better figure out whether the name has no encoding and why.
You fix missing encoding with DefineEncoding.[/quote]
But on his sample he defined a fixed string which is by definition UTF8. So ConvertEncoding ist correct here.
Your note is still valid for strings from an external source where the encoding is unknown.
[code] Function FixEncoding(extends text as string) As string
// we only want UTF8, so fix everything
if text.Encoding = nil then
'break
if encodings.UTF8.IsValidData(text) then
Return DefineEncoding(text, encodings.UTF8)
else
text = DefineEncoding(text, encodings.ISOLatin1)
end if
end if
text = ConvertEncoding(text, encodings.UTF8)
Return text
End Function[/code]
dim f1 As FolderItem = dt.Child(“Blöd”)
me.AppendText “Blöd:” + f1.NativePath + " (" + f1.Name + “)” + EndOfLine
dim f2 As FolderItem = f1.Child("???.txt")
me.AppendText “txt:” + f2.NativePath + " (" + f2.Name + “)” + EndOfLine[/code]
Result is
Perhaps you should tell us what Windows and Xojo version you use.[/quote]
I use Xojo 2017r2.1 on Windows 7 and haven’t tried on Windows 10.
Thank you for all the suggestions but I have not found one that works, mainly because I don’t know which text object of the GetFolderItem Xojo allows me to convert. When I try the FolderItem.AbsolutePath for example, Xojo tells me “Cannot assign a value to this property.”