FolderItem.Name: Encoding question

I have a project who scans a folder full of folders with - sometimes - Characters with values above 127 and below 256.

I build a report in html (but html here is not the problem).

Some days ago I had “Météor” in all sub-folders of a Master Folder and I ger troubles in the generated html.
I found where the problem lies and I put a work around FOR THIS Master folder. Of course this work-around will ot work on another Master folder.

So, I looked at my project code and found nowhere a Locale missing.

And (or But ?), there was no bug with Object names without the non ASCII characters (I had to remove that " - 5" work-around for these Master Folders…).

So, this is really an Encoding Bug, but where ?

My answer was: "If this is in the Folder Names insode the Master Folder, set there an encoding and see what happens…”

Now, minutes ago I get suspicious about FolderItem.Name. (Read above)
So, I read the documentation entry for FolderItem.Name and found nothing about Encoding.

At least, I decided to change the FolderItem.Name and set it an encoding:


For Each Loc_FI As FolderItem In gMaster_FI.Children
  Var Loc_Name As String // The item name
  
Loc_Name = Loc_FI.Name.DefineEncoding(Encodings.UTF8)

Liste.Add Loc_FI.Name
Next

This is basically the used code; only change is:
.DefineEncoding(Encodings.UTF8)

The trouble was cleared.

Your opinion ?

PS: this is a typic US-developers bug because they do not use these characters. A bug nearly only foreigner can detect (of course !)

I’m very surprised that the encoding was not already set.

In my experience under macOS the name returned by FolderItem.Name will already have an encoding and that encoding will be UTF-8, so using DefineEncoding wouldn’t make any difference. Non-ASCII characters don’t create any issues.

Did you check whether the name was really missing an encoding?

Thanks folks for your ansers.

Me too, thus my question.

No, since I had a trouble, I only checked if that makes a difference.

In the mean time, I used that project with a Master folder whose childs names does not have non ASCII characters in it: works fine, no error found.

BTW: I use .IndexOf(String, ComparisonOptions, Locale) to place a Table of Contents (in html of course) at the beginning of the file because it is build separately when I extract the data for each Master_FI.Child…

Doh: while serching for IndexOf, I searched InStr and found some. The problem may lies there (maybe for some reason it is saved by my change ?). I will search that when at home.

When I do not understand and have no more ideas, even a stupid change is OK for testings. In that case, I was quite sure there will be no change, but… (sometimes I add some commented lines, sometimes I remove commented lines of code…
The only thing I do not do is to knowck 3 times the table. :wink: