[Gambas-user] How to manage filenames whit invalid characters in gambas.

Gianluigi gradobag at gradobag.it
Thu Feb 16 12:33:07 CET 2023


Il 16/02/23 11:16, Martin ha scritto:
> El 16/2/23 a las 10:21, Gianluigi escribió:
>> If you start this project, what happens, do you get the same characters?
> Hi Gianluigi.
>
> Thank you for preparing an example project.
>
> The project don't show any file with the "wrong" characters, see the 
> attachment please.
>
> I also made a testing program to play with the text, please be free to 
> try it.
>
> btw, the charcter (?) is
> https://www.codetable.net/decimal/65533
>
> But it only appear if I copy the file name from the thunar file 
> borwser, wich means that the file browser show something different to 
> the raw name, so in Gambas algorithms the raw file name is obtained 
> and I can operate or rename it.
>
> The trouble is solved more or less.
>
> I chek the gambas wiki and found a function that will help: IsAscii()
>
> Regards.
> Martin
>
> ----[ http://gambaswiki.org/wiki/doc/netiquette ]----

Hi Martin,

perhaps you imported without conversion files or folders from other 
non-UTF-8 systems

Ex.
   Dim s As String = "09_sal�vac�mp3"

   Try s = Conv$(s, "ISO-8859-1", "UTF-8")
   ' or
   ' Try s = Conv$(s, "Windows-1252", "UTF-8")
   s = Replace(s, "�", ".")
   TextBox1.Text = s
   If Error Then Print Error.Text

Regards

Gianluigi



More information about the User mailing list