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

RE: encoding shift_jis into an attribute

Subject: RE: encoding shift_jis into an attribute
From: "Matthew Simoneau" <Matthew.Simoneau@xxxxxxxxxxxxx>
Date: Fri, 4 Jun 2004 14:04:25 -0400
urldecoder.decode
Wendell, thanks for the information about disable-output-escaping.

Josh, my first reaction was to do as you suggest and decode these URI
scheme strings in my MATLAB or Java code and then recode them in the XML
scheme.  I couldn't get the decoding to work properly in my Java code.
If XML document contains the Unicode character sequence "25968 23398",
it is represented in the URI scheme as "%E6%95%B0%E5%AD%A6".  To try to
reconstitute these original characters with Java, I tried something like
java.net.URLDecoder.decode("%E6%95%B0%E5%AD%A6").  This returned the
nonsense sequence of Unicode characters "35624 65392 34756 65382", so I
started looking for other options.  Your e-mail made me go back and try
this again.  I realized it was taking every two bytes and making them
one character.  That is, decode was defaulting to Shift-JIS, my
platform's default.  I also saw that the decode method could take an
encoding as an optional second argument.  If I specify
java.net.URLDecoder.decode("%E6%95%B0%E5%AD%A6","UTF-8"), I get back my
original sequence "25968 23398".  Slapping a "&#" and ";" around each
gets it into the form I want.  If I can't find a standard Java class to
do that, I can easily write my own.

Thank you everyone for your help.

Sincerely,
Matthew Simoneau
The MathWorks, Inc.

Current Thread

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
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.