You are viewing a plain text version of this content. The canonical link for it is here.
Posted to slide-dev@jakarta.apache.org by di...@the-ecorp.com on 2001/04/24 13:32:48 UTC

RE: Character Encodings was: RE: JDBCDescriptorStore and escap ing SQL

I'm sending in 2 patches for character encoding problems (client proppatch /
server propfind)
and one client bugfix.

These should solve the problems but be carefull when getting a writer from a
servletresponse
(set contenttype first) and when transforming a string to a byte array
(specify encoding).

Greetings
Dirk

-----Original Message-----
From: dirk.verbeeck@the-ecorp.com [mailto:dirk.verbeeck@the-ecorp.com]
Sent: Monday, April 23, 2001 3:41 PM
To: remm@apache.org
Cc: slide-dev@jakarta.apache.org
Subject: Character Encodings was: RE: JDBCDescriptorStore and escaping
SQL


Yes, I'm using the Slide Client (1.0.9) to do a proppatch.
server and client are both on NT4.

Found the problem with é, it is the character encoding in
WebdavMethod::readRequestContent()
requestBody = new
String(NodeRevisionContent.readFromStream(req.getInputStream()),
                   getEncodingString(req.getCharacterEncoding()));

The req indicated that the encoding is utf-8 but it isn't and therefor the
string is truncated.
utf-8: <?xml version="1.0" encoding="utf-8" ?><D:propertyupdate
xmlns:D="DAV:"><D:set><D:prop><a>a 
ISO-8859-1: <?xml version="1.0" encoding="utf-8" ?><D:propertyupdate
xmlns:D="DAV:"><D:set><D:prop><a>aéa</a></D:prop></D:set></D:propertyupdate>


The WebdavClient::sendRequest doesn't send the bytes in utf-8 but uses the
default.
            requestOutputStream.write(query.getBytes());

I tried to change the client to send utf-8 but then there is anoter error.
            requestOutputStream.write(query.getBytes("utf-8"));

the requestBody (on the server) is truncated by 1.

<?xml version="1.0" encoding="utf-8" ?>
<D:propertyupdate xmlns:D="DAV:"><D:set><D:prop><a>aéa</a>
</D:prop>
</D:set>
</D:propertyupdate
org.xml.sax.SAXParseException: Next character must be ">" terminating
element "D
:propertyupdate".
        at com.sun.xml.parser.Parser.fatal(Parser.java:2817)


I'm looking into that now.


Dirk


-----Original Message-----
From: Remy Maucherat [mailto:remm@apache.org]
Sent: Friday, April 20, 2001 8:02 PM
To: slide-dev@jakarta.apache.org
Subject: Re: JDBCDescriptorStore and escaping SQL

> I've just tied a proppatch and got the following error:
>
> 20 Apr 2001 11:36:00 - INFO - PROPPATCH (time: 31 ms) URI =
> /files/draft-fr.xml
> org.xml.sax.SAXParseException: End of entity not allowed; an end tag is
> missing.
>         at com.sun.xml.parser.Parser.fatal(Parser.java:2817)
>         at com.sun.xml.parser.Parser.fatal(Parser.java:2805)
>         at com.sun.xml.parser.Parser.content(Parser.java:1553)
>         at com.sun.xml.parser.Parser.maybeElement(Parser.java:1400)
>         at com.sun.xml.parser.Parser.content(Parser.java:1499)
>         at com.sun.xml.parser.Parser.maybeElement(Parser.java:1400)
>         at com.sun.xml.parser.Parser.content(Parser.java:1499)
>         at com.sun.xml.parser.Parser.maybeElement(Parser.java:1400)
>         at com.sun.xml.parser.Parser.content(Parser.java:1499)
>         at com.sun.xml.parser.Parser.maybeElement(Parser.java:1400)
>         at com.sun.xml.parser.Parser.parseInternal(Parser.java:492)
>         at com.sun.xml.parser.Parser.parse(Parser.java:284)
>         at
> com.sun.xml.parser.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:95)
>         at
>
org.apache.slide.webdav.method.PropPatchMethod.parseRequest(PropPatchMethod.
> java:168)

The exception occurs when parsing the request.
Are you using the Slide WebDAV client ?

Remy