Re: [Development] [Question] Implementation of XML character validation

2013-09-08 Thread Giuseppe D'Angelo
Hi, please, let's keep the discussion on the ML. On 8 September 2013 23:10, Kurt Pattyn wrote: > Hi Giuseppe, > > this is not mentioned in the documentation, and, if QChar is following the > Unicode v6.2 standard, cannot be correct, as the method unicode() returns a > 16-bit value, which even

Re: [Development] [Question] Implementation of XML character validation

2013-09-08 Thread Thiago Macieira
On domingo, 8 de setembro de 2013 23:42:57, Konstantin Ritt wrote: > No. QString operates on UCS-2, not UCS-4. QString operates on UTF-16, not UCS-2. -- Thiago Macieira - thiago.macieira (AT) intel.com Software Architect - Intel Open Source Technology Center signature.asc Description: This is

Re: [Development] [Question] Implementation of XML character validation

2013-09-08 Thread Kurt Pattyn
On 08 Sep 2013, at 22:42, Konstantin Ritt wrote: > 2013/9/8 Kurt Pattyn >> Couldn't it be a solution to expand QChar to contain 32-bit code points iso >> 16-bit, and have the unicode() function return an UCS4 value? >> >> At least, I think it would be nice that the checks for valid XML ch

Re: [Development] [Question] Implementation of XML character validation

2013-09-08 Thread Thiago Macieira
On domingo, 8 de setembro de 2013 23:05:49, Kurt Pattyn wrote: > So, either the documentation of QChar should at least indicate that it is > encoded in UTF-16, which I doubt (because then QChar should have place for > 2 16-bit values), or QChar should be adapted to conform to the statement > that Q

Re: [Development] [Question] Implementation of XML character validation

2013-09-08 Thread Konstantin Ritt
Neither of these relates to some specific Unicode version. QChar is a 16-bit Unicode character part. QString is UCS-2-encoded. Read about UTF-16 for more info. Also !qdoc: QChar::highSurrogate(), QChar::lowSurrogate() Regards, Konstantin 2013/9/9 Kurt Pattyn > Hi Konstantin, > > that is exactl

Re: [Development] [Question] Implementation of XML character validation

2013-09-08 Thread Thiago Macieira
On domingo, 8 de setembro de 2013 22:39:07, Kurt Pattyn wrote: > Couldn't it be a solution to expand QChar to contain 32-bit code points iso > 16-bit, and have the unicode() function return an UCS4 value? Maybe in Qt 7. (No, this is not a typo) -- Thiago Macieira - thiago.macieira (AT) intel.com

Re: [Development] [Question] Implementation of XML character validation

2013-09-08 Thread Kurt Pattyn
Hi Konstantin, that is exactly what I did. From the Qt5 documentation: > The QChar class provides a 16-bit Unicode character. > In Qt, Unicode characters are 16-bit entities without any markup or > structure. This class represents such an entity. It is lightweight, so it can > be used everywhere

Re: [Development] [Question] Implementation of XML character validation

2013-09-08 Thread Giuseppe D'Angelo
On 8 September 2013 22:42, Kurt Pattyn wrote: > Isn't it supposed that a QChar contains a Unicode character (which is 32-bit > in size)? No, a QChar is exactly an UTF-16 code unit. -- Giuseppe D'Angelo ___ Development mailing list Development@qt-proj

Re: [Development] [Question] Implementation of XML character validation

2013-09-08 Thread Konstantin Ritt
Plz read the docs. Regards, Konstantin 2013/9/8 Kurt Pattyn > On 08 Sep 2013, at 20:43, Thiago Macieira > wrote: > > > On domingo, 8 de setembro de 2013 20:36:39, Kurt Pattyn wrote: > > > > It's limited by the size of QChar. It cannot contain 0x1. > > > Isn't it supposed that a QChar cont

Re: [Development] [Question] Implementation of XML character validation

2013-09-08 Thread Konstantin Ritt
2013/9/8 Kurt Pattyn > Couldn't it be a solution to expand QChar to contain 32-bit code points > iso 16-bit, and have the unicode() function return an UCS4 value? > > At least, I think it would be nice that the checks for valid XML > characters would be concentrated in one place. > No. QString

Re: [Development] [Question] Implementation of XML character validation

2013-09-08 Thread Kurt Pattyn
On 08 Sep 2013, at 20:43, Thiago Macieira wrote: > On domingo, 8 de setembro de 2013 20:36:39, Kurt Pattyn wrote: > > It's limited by the size of QChar. It cannot contain 0x1. > Isn't it supposed that a QChar contains a Unicode character (which is 32-bit in size)? Regards, Kurt __

Re: [Development] [Question] Implementation of XML character validation

2013-09-08 Thread Kurt Pattyn
On 08 Sep 2013, at 20:43, Thiago Macieira wrote: > On domingo, 8 de setembro de 2013 20:36:39, Kurt Pattyn wrote: >> bool QXmlUtils::isChar(const QChar c) >> { >>return (c.unicode() >= 0x0020 && c.unicode() <= 0xD7FF) >> || c.unicode() == 0x0009 >> || c.unicode() == 0x000A

Re: [Development] [Question] Implementation of XML character validation

2013-09-08 Thread Thiago Macieira
On domingo, 8 de setembro de 2013 20:36:39, Kurt Pattyn wrote: > bool QXmlUtils::isChar(const QChar c) > { > return (c.unicode() >= 0x0020 && c.unicode() <= 0xD7FF) >|| c.unicode() == 0x0009 >|| c.unicode() == 0x000A >|| c.unicode() == 0x000D >||

Re: [Development] [Question] Implementation of XML character validation

2013-09-08 Thread Kurt Pattyn
On 08 Sep 2013, at 20:01, development-requ...@qt-project.org wrote: > From: Konstantin Ritt > Subject: Re: [Development] [Question] Implementation of XML character > validation > Date: 8 Sep 2013 20:00:45 GMT+02:00 > To: "development@qt-project.org" > > >

Re: [Development] [Question] Implementation of XML character validation

2013-09-08 Thread Konstantin Ritt
[2] Char ::= #x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD] | [#x1-#x10]/* any Unicode character, excluding the surrogate blocks, FFFE, and . */ in XML 1.0 is quite the same as [2] Char ::= [#x1-#xD7FF] | [#xE000-#xFFFD] | [#x1-#x10] /* any Unicode character,

[Development] [Question] Implementation of XML character validation

2013-09-08 Thread Kurt Pattyn
All XML validation in Qt is based on XML 1.0 (and not the newer 1.1 standard). I found at least 3 places where validity is checked: 1. in qxmlstream.cpp: Method resolveCharRef: //checks for validity ok &= (s == 0x9 || s == 0xa || s == 0xd || (s >= 0x20 && s <= 0xd7ff)