Dear Andreas,
Thank you for you fast reply !
In my case, I get everything but readable text (Russian
data),
because my platform's default character encoding is 'windows-1252'
and according the ByteArrayOutputStream API documentation
:
toString
public String toString()
- Converts the buffer's contents into a string, translating bytes into
characters according to the platform's default character encoding.
-
- Overrides:
toString
in class Object
-
- Returns:
- String translated from the buffer's contents.
- Since:
- JDK1.1
So I had to force UTF-8 conversion using toString("UTF-8") in
the receive and execute methods...
This could be a problem for others users.
Thank you for your great great job,
XML files' nightmare is other for me, thanks
to BaseX !
Best regards
Fabrice
Dear Fabrice,
the whole client-server communication is in
UTF-8 so the strings
havn't to be converted.
Kind
regards,
Andreas
Am 04.01.11 14:36, schrieb Fabrice Etanchaud:
Dear all at dbis,
best greetings for the new year !
in the java
binding class 'BaseXClient',
is there any
reason not to add UTF-8 encoding when transforming outputstream into string
?
String receive() throws IOException
{
final ByteArrayOutputStream os =
new ByteArrayOutputStream();
receive(os);
return os.toString("UTF-8");
// return os.toString();
}
public String execute(final String cmd) throws IOException {
final OutputStream os = new ByteArrayOutputStream();
execute(cmd, os);
return os.toString("UTF-8");
//
return
os.toString();
}
In which encoding is BaseX data internally stored, and then
restituted ?
best
regards,
Fabrice
ETANCHAUD
_______________________________________________
BaseX-Talk mailing list
BaseX-Talk@mailman.uni-konstanz.de
https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk