German umlaute with GetFolderItem

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?

Thank you

Maybe because of the encoding? Try this (not tested – I am not on a computer right now):

Dim dir As String = "Persönlich" dir = s.ConvertEncoding(Encodings.WindowsLatin1) ...

Also your post should probably be filed under Windows and not General.

No issue here on Windows 10 with Xojo 2017r2.1. Even Japanese chars work well.

Code from my test app in the open event of a TextArea:

[code]dim dt as FolderItem = SpecialFolder.Desktop
me.AppendText “Desktop:” + dt.NativePath + " (" + dt.Name + “)” + EndOfLine

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

[quote]Desktop:C:\Users\fusionWin10\Desktop\ (Desktop)
Blöd:C:\Users\fusionWin10\Desktop\Blöd\ (Blöd)
txt:C:\Users\fusionWin10\Desktop\Blöd\???.txt (???.txt)[/quote]

Perhaps you should tell us what Windows and Xojo version you use.

@Eli Ott not ConvertEmcoding.

Better figure out whether the name has no encoding and why.

You fix missing encoding with DefineEncoding.

[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.

than maybe a bug in Xojo?

I found this function in one o four projects:

[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]

[quote=354846:@Thomas Eckert]No issue here on Windows 10 with Xojo 2017r2.1. Even Japanese chars work well.

Code from my test app in the open event of a TextArea:

[code]dim dt as FolderItem = SpecialFolder.Desktop
me.AppendText “Desktop:” + dt.NativePath + " (" + dt.Name + “)” + EndOfLine

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.”