Skip to Content
Former Member
May 22, 2005 at 11:21 AM

Reading mixed language content from a resource


Hello all,

I have a resource 'res' and I want to read its contents. I've written the following code to do this.

StringBuffer sb = new StringBuffer();
IContent con = res.getUnfilteredContent();
int len = (int)con.getContentLength();// It's a small resource
byte[] bArray = new byte[len];
InputStream is = con.getInputStream();, 0, len);
for(int i=0;i<bArray.length;i++)
  sb.append((char)(bArray<i> & 0xFF));
return sb.toString();

This reads English fine but my resource has English and another language which comes back as garbage.

It's an XML Form that I'm reading and I'm trying to grab a specific element, an image link. The path is mixed language.

Any ideas what I can do to solve this?