Hi Andreas

That's it! Many thanks for your efforts!

Oliver Hirschi


"Andreas Veithen" <[EMAIL PROTECTED]> schrieb im Newsbeitrag news:[EMAIL PROTECTED]
Hi Oliver!

The code you use to read the content of the file is incorrect. The size of the char array you are allocating equals the file size, which is calculated in number of bytes. For UTF-8, if special characters appear in the file, the number of characters is less than the number of bytes. Therefore you will indeed have null characters at the end of your array. I suggest to use one of the IOUtils.toString methods from Commons IO to read the file content as a string.

Andreas

On 11 Feb 2008, at 16:01, Oliver Hirschi wrote:

> Hi
>
> I try to call a soap-service on an axis2 1.3 server with only one > string argument. The value of the string argument I get from a file > which is utf-8 encoded and contains special characters like "äöü".
>
> I read the file as followed:
> ----------------------------
> Reader in = new InputStreamReader(new > FileInputStream(m_sUploadFile), "UTF-8");
> char[] chr = new char[(int)new File(m_sUploadFile).length()];
> in.read(chr);
> in.close();
> String sArgument = new String(chr);
> ----------------------------
>
> ...



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to