[Gambas-user] Re: a bug report?

Benoit Minisini gambas at ...1...
Tue Jan 20 19:39:07 CET 2004


On Tuesday 20 January 2004 15:54, you wrote:
> Hi.
> I'm doing a little program, but I have a problem with this code
>
> IF (sExtension = "cbr") THEN
>     EXEC ["unrar", "x", "-o+", "-inul" ,$sComicFile, "/tmp/comics/" &
> $sName & "/"] WAIT
>   ELSE
>     EXEC ["unzip", "-o","-qq", $sComicFile, "-d", "/tmp/comics/" & $sName &
> "/"] WAIT
>   ENDIF
>
> It appears work correcly,  unless $sComicFile have the "º".If exist this
> character
> unzip and unrar  give me an error
>
> for example
> if the value of $sComicFile =
> /home/david/Spider-Man Nº12.-.Peter.Parker.Vol.2.#011.cbr
>
> the error is
> Cannot open /home/david/Spider-Man Nº12.-.Peter.Parker.Vol.2.#011.cbr
> No files to extract
>
> Is a bug that always EXEC replace the character "º" for "º" ?
>
> regards
>

It is not a bug, it is a feature. :-)

When you write your code in the editor, everything is coded with the UTF-8 
charset.

When a Gambas file related instruction (OPEN, KILL, RENAME, etc.) receives a 
file name, it automatically converts it from UTF-8 to the internal system 
charset.

But this conversion does not occur when you use the EXEC or SHELL instruction, 
because a command parameter may be a file, or may not!

So, you must do:

EXEC ["unrar", "x", "-o+", "-inul", Conv($sComicFile, Desktop.Charset, 
System.Charset), "/tmp/comics/" & $sName & "/"] WAIT

I know this is boring, but this is the price for Gambas projects being 
internationalizable.

Note that on RedHat/Fedora, System.Charset = Desktop.Charset = "UTF-8". Maybe 
one day, all Linux systems will be integrally UTF-8 based, and this charset 
conversion will not be necessary.

Regards,

-- 
Benoit Minisini
mailto:gambas at ...1...





More information about the User mailing list