[Gambas-user] Quote() doesn't manage special italian chars - bug?

Benoit Minisini gambas at ...1...
Sat Nov 10 13:04:49 CET 2007


On samedi 10 novembre 2007, Stefano Palmeri wrote:
> Alle 12:44, sabato 10 novembre 2007, Benoit Minisini ha scritto:
> > On vendredi 9 novembre 2007, Stefano Palmeri wrote:
> > > Alle 20:11, venerdì 9 novembre 2007, Benoit Minisini ha scritto:
> > > > On vendredi 9 novembre 2007, Stefano Palmeri wrote:
> > > > > Hi, Benoit
> > > > >
> > > > > Playing with Quote() in a SHELL command I discovered that
> > > > > Quote() is not able to manage special italian chars. I don't
> > > > > know if the bug(?) exists with other languages.
> > > > >
> > > > > Here is an example and the result:
> > > > >
> > > > >  PUBLIC SUB Main()
> > > > >
> > > > >   PRINT Quote("è, più, però, perché")
> > > > >
> > > > > END
> > > > >
> > > > > "\xC3\xA8, pi\xC3\xB9, per\xC3\xB2, perch\xC3\xA9"
> > > > >
> > > > >
> > > > > Stefano
> > > >
> > > > Actually, if you type
> > > >
> > > > PRINT "\xC3\xA8, pi\xC3\xB9, per\xC3\xB2, perch\xC3\xA9"
> > > >
> > > > you should get the original string.
> > >
> > > Yes, but it's not very comfortable :-)
> > >
> > > > But apparently there is a bug in the compiler. You have to add a
> > > > space at the end of the string. I will fix it as soon as possible.
> > >
> > > Anyway, adding a space didn't solve the little bug. At the
> > > moment I use a PersonalQuote() function as workaround.
> > >
> > > Regards,
> > >
> > > Stefano
> >
> > I fixed the bug in the last revision, but why do you need to quote
> > strings differently from what does the Quote() function?
>
> No, no. I don't need a different behaviour. I need a normal behaviour, but
> Quote() was buggy with special chars.
> As I told you, I was playing, with SHELL. Exactly I was oggencodin a file
> called "F. B. - Gravità Permanente.wav".
>
> I had to Quote() the file in the SHELL command, because oggenc
> believes that name is not a single file.
>
> sfile = "F. B. - Gravità Permanente.wav"
> SHELL "oggenc -q 6 " & Quote(sfile) WAIT
>
> but Quote() returned that bad char (instead of à) and oggenc didn't find
> the file. So I found the bug.
> If I don't Quote() oggenc thinks that name is non a uniq file.
>
> As workaround I quoted myself with "\"" & sfile & "\"", and that's solved
> the question.
>
> I hope, I was clear.
>
> Thanks for fixing. I think I will test in the afternoon.
>
> Best regards,
>
> Stefano
>

Quote() is not buggy. It is just not to be used with SHELL. You must use the 
Quote.Shell() method if you want to send argument strings to the SHELL 
command safely.

Regards,

-- 
Benoit Minisini




More information about the User mailing list