[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: An XML document is not well-formed if encoding="..." does

  • From: Hermann Stamm-Wilbrandt <STAMMW@de.ibm.com>
  • To: Jim DeLaHunt <from.xml-dev@jdlh.com>
  • Date: Sun, 30 Dec 2012 19:00:55 +0100

RE:  An XML document is not well-formed if encoding="..."  does
Hi Jim,

> While we're at it, note that the ratio of bytes-for-UTF-8 /
> bytes-for-UTF-16 ranged from a high of 129% (again for Japanese) to a
> low of 51% (for English).  Actually, Japanese, Korean and simplified
> Chinese were the only languages in the sample where UTF-8 took more
> bytes than UTF-16. For Traditional Chinese and all other languages in
> the sample, UTF-8 was more compact.
>
thanks for sharing these (interesting) numbers.

> >And does it matter much ?
>
> I would say, with just a little bit of snark, that anyone choosing to
> mark up their document with an XML language has already declared they
> don't care much about file size being bloated. :-)
>
;-)

I think one of the main reasons for using UTF-8 in XML processing systems
is that it is the default encoding in stylesheets (when  encoding="..."
is missing in <xsl:output>.

I do not know the internals of other XSLT processors, but DataPower XSLT
processor internal encoding is UTF-8 ([1], slide 11).

Btw, proprietary extensions allowing to process Non-XML data in
stylesheets can enable even (XML) processing for character encodings the
XSLT processor cannot handle directly ([2], slides 12-14).
(the audio recording has the details)


[1] http://www-01.ibm.com/support/docview.wss?uid=swg27022977
[2] http://www-01.ibm.com/support/docview.wss?uid=swg27022979

Mit besten Gruessen / Best wishes,

Hermann Stamm-Wilbrandt
Level 3 support for XML Compiler team and Fixpack team lead
WebSphere DataPower SOA Appliances
https://www.ibm.com/developerworks/mydeveloperworks/blogs/HermannSW/
https://twitter.com/HermannSW/
----------------------------------------------------------------------
IBM Deutschland Research & Development GmbH
Vorsitzende des Aufsichtsrats: Martina Koederitz
Geschaeftsfuehrung: Dirk Wittkopp
Sitz der Gesellschaft: Boeblingen
Registergericht: Amtsgericht Stuttgart, HRB 243294


|------------>
| From:      |
|------------>
  >-----------------------------------------------------------------------------------------------------------------------------------------|
  |Jim DeLaHunt <from.xml-dev@jdlh.com>                                                                                                     |
  >-----------------------------------------------------------------------------------------------------------------------------------------|
|------------>
| To:        |
|------------>
  >-----------------------------------------------------------------------------------------------------------------------------------------|
  |David Lee <dlee@calldei.com>,                                                                                                            |
  >-----------------------------------------------------------------------------------------------------------------------------------------|
|------------>
| Cc:        |
|------------>
  >-----------------------------------------------------------------------------------------------------------------------------------------|
  |Chris Maloney <voldrani@gmail.com>, "Costello, Roger L." <costello@m...>, "xml-dev@l..." <xml-dev@l...>           |
  >-----------------------------------------------------------------------------------------------------------------------------------------|
|------------>
| Date:      |
|------------>
  >-----------------------------------------------------------------------------------------------------------------------------------------|
  |12/30/2012 06:49 AM                                                                                                                      |
  >-----------------------------------------------------------------------------------------------------------------------------------------|
|------------>
| Subject:   |
|------------>
  >-----------------------------------------------------------------------------------------------------------------------------------------|
  |RE:  An XML document is not well-formed if encoding="..."  does not match the actual encoding of the characters in the document,|
  |right?                                                                                                                                   |
  >-----------------------------------------------------------------------------------------------------------------------------------------|





David: [re-send, including the xml-dev list]

At 2:53 AM +0000 12/30/12, David Lee wrote:
>For people who use languages which have predominantly non-latin
codepoints ...
>Is UTF8 actually worse than UTF32  - file size wise ?

No, I believe not. Deducing from the definition of UTF-8 and UTF-32,
there is no sequence of Unicode character values for which the UTF-8
representation requires more bytes than the UTF-32 representation. On
the contrary, in all but pathological cases the UTF-8 representation
will require fewer bytes.

The best answer to the Stack Overflow question, "at all times text
encoded in UTF-8 will never give us more than a +50% file size of the
same text encoded in UTF-16. true / false?",
http://stackoverflow.com/questions/6883434/at-all-times-text-encoded-in-utf-8-will-never-give-us-more-than-a-50-file-size

,

has a case study comparing the number of characters and UTF8 bytes
for the text content of several language versions of the Wikipedia
"Tokyo" article.  Extending the results table there a bit, we see
that the ratio of bytes-for-UTF-8 / bytes-for-UTF-32 ranged from a
high of 65% (for Japanese) to a low of 26% (for English, Spanish, and
French).

While we're at it, note that the ratio of bytes-for-UTF-8 /
bytes-for-UTF-16 ranged from a high of 129% (again for Japanese) to a
low of 51% (for English).  Actually, Japanese, Korean and simplified
Chinese were the only languages in the sample where UTF-8 took more
bytes than UTF-16. For Traditional Chinese and all other languages in
the sample, UTF-8 was more compact.

>And does it matter much ?

I would say, with just a little bit of snark, that anyone choosing to
mark up their document with an XML language has already declared they
don't care much about file size being bloated. :-)

But there are other factors in choosing a Unicode Transformation
Format (UTF) to represent text. For some applications, UTF-32's 1:1
mapping of code unit to character might valuable.

>Considering that UTF16 is a dangerous file format,  (I agree it is ... )

Personally, I don't concede that point. It's harder to use it with
tools that assume byte-aligned code units.  But there are many tools
which are happy to work with 16-bit code units.

>I dont think any convention that requires you to have read "the
>Beginning" will consistently work with text ...
>XML suffers with this assumption as well with the XML declaration
>declaring the encoding.
>That only works when you have an entire document to look at. ...

I very much agree with this observation.

--
     --Jim DeLaHunt, jdlh@jdlh.com     http://blog.jdlh.com/ (
http://jdlh.com/)
       multilingual websites consultant

       157-2906 West Broadway, Vancouver BC V6K 2G8, Canada
          Canada mobile +1-604-376-8953

_______________________________________________________________________

XML-DEV is a publicly archived, unmoderated list hosted by OASIS
to support XML implementation and development. To minimize
spam in the archives, you must subscribe before posting.

[Un]Subscribe/change address: http://www.oasis-open.org/mlmanage/
Or unsubscribe: xml-dev-unsubscribe@lists.xml.org
subscribe: xml-dev-subscribe@lists.xml.org
List archive: http://lists.xml.org/archives/xml-dev/
List Guidelines: http://www.oasis-open.org/maillists/guidelines.php






[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]


PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.