Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Contributor
Posts: 22
Registered: ‎05-14-2012
My Device: bold 9700
My Carrier: vodafone

Re: Sqlite Large Data

Hi,

I tried to store all sql files in web (http://www.xxxxx.com/data.txt) and connected it. It is OK.

 

But Turkish character is problem now. File saved as UTF-8.

 

how can I resolve it? 

Contributor
Posts: 22
Registered: ‎05-14-2012
My Device: bold 9700
My Carrier: vodafone

Re: Sqlite Large Data

I solved problem by this function 

 

public static String getStringFromStream(InputStream in, String encoding) throws IOException {
InputStreamReader reader;
if (encoding == null) {
reader = new InputStreamReader(in);
} else {
reader = new InputStreamReader(in, encoding);
}

StringBuffer sb = new StringBuffer();

final char[] buf = new char[1024];
int len;
while ((len = reader.read(buf)) > 0) {
sb.append(buf, 0, len);
}

return sb.toString();
}

 

and use


String response=getStringFromStream(httpInput, "UTF-8");