CSS Parser and Qt/e 2.

Luciano Montanaro mikelima at cirulla.net
Fri Jan 27 10:00:06 GMT 2006


On Friday 27 January 2006 08:10, Stefan Eilers wrote:
> Am 26.01.2006 um 19:43 schrieb Maks Orlovich:
> >> If plain ascii is sufficient, I think converting the string to
> >> latin1 and
> >> redefining YY_CHAR to unsigned char should do.
> >
> > Doing ascii would be wrong, since CSS can have Unicode strings in it.
>
> How often does it happen? Use ascii would be the the only solution I
> see..
>
> > (And personally, I don't understand the issue with byteswapping)
>
> Well. If YY_CHAR is an unsigned short and it reads on a little endian
> machine  0x002f, it would interpret this as (for instance) chinese
> char. If it reads 0x2f00 it would be a "/". This is the reason why
> the parser is irritated by big endian encoded  QChars.
>
> I'm currently thinking of using the default flex (which does not
> understand unicode by default) to generate a complete new lexical
> scanner. Therefore It is important to know whether unicode CSS
> strings just happen theoretically or does they exist in reality.
>

Actually, what I don't understand is why doing a (conditional, if the arch 
endiannes requires it) byte swapping does not work.
Or changing the memcpy()s with something like:
for (int i = 0;	i < length; i++) {
    data[i] = string[i].unicode();
} 


-- 
Luciano Montanaro //
              \\ //
               \x/ www.cirulla.net




More information about the kfm-devel mailing list