私はドイツのAppを開発しています。これはJSONからListViewにデータを取得します。 üöäßのような特殊文字があるので、私のコードでは、これらの文字はと表示されますか?。JSON(ööüß)の特殊文字をエンコード
誰かが私の問題を解決するのに役立つことができますか? THX
public class LooserSync extends IntentService {
public LooserSync() {
super("LooserSyncService");
}
@Override
protected void onHandleIntent(Intent intent) {
Database.OpenHelper dbhelper = new Database.OpenHelper(getBaseContext());
SQLiteDatabase db = dbhelper.getWritableDatabase();
DefaultHttpClient httpClient = new DefaultHttpClient();
db.beginTransaction();
HttpGet request = new HttpGet(
"http://liebenwald.spendino.net/admanager/dev/android/projects.json");
try {
HttpResponse response = httpClient.execute(request);
if (response.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
InputStream instream = response.getEntity().getContent();
BufferedReader r = new BufferedReader(new InputStreamReader(
instream), 8000);
StringBuilder total = new StringBuilder();
String line;
while ((line = r.readLine()) != null) {
total.append(line);
}
instream.close();
String bufstring = total.toString();
JSONArray arr = new JSONArray(bufstring);
Database.Tables tab = Database.Tables.AllTables.get(Database.Project.NAME);
tab.DeleteAll(db);
for (int i = 0; i < arr.length(); i++) {
tab.InsertJSON(db, (JSONObject) arr.get(i));
}
db.setTransactionSuccessful();
}
} catch (Exception e) {
e.printStackTrace();
}
db.endTransaction();
db.close();
}
}
私のために働いてくれてありがとう.Laurent Etiemble。 – nikki