I am trying to develop a Korean vocabulary app but I am having trouble inserting the Korean words into the database and displaying them: they're displayed as a string of weird characters. Is there any way to solve this? Or I can only display Korean words as images? Do I need to configure something?
So far I changed the text-file encoding to "Other:UTF-8". But that doesn't solve the problem. I am now developing using Android Phonegap. Any tips or hints will be greatly appreciated. Thank you.
===UPDATED====
<script type="text/javascript" charset="utf-8">
// Wait for PhoneGap to load
//
document.addEventListener("deviceready", onDeviceReady, false);
// Populate the database
//
function populateDB(tx) {
tx.executeSql('DROP TABLE IF EXISTS DEMO');
tx.executeSql('CREATE TABLE IF NOT EXISTS DEMO (id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, kword TEXT NOT NULL, eword TEXT NOT NULL, pronoun TEXT NOT NULL, level INTEGER NOT NULL)');
tx.executeSql('INSERT INTO DEMO (id, kword, eword, pronoun, level) VALUES ("1", "점심", "Lunch", "jeomsim", "1")');
tx.executeSql('INSERT INTO DEMO (id, kword, eword, pronoun, level) VALUES ("2", "晚餐", "Dinner", "naeil", "1")');
}
// Query the database
//
function queryDB(tx) {
tx.executeSql('SELECT * FROM DEMO', [], querySuccess, errorCB);
}
// Query the success callback
//
function querySuccess(tx, results) {
var data ='';
var len = results.rows.length;
localStorage.tablerows = len;
for (var i=0; i<len; i++){
data = data +"<tr><td>"+results.rows.item(i).id +"</td><td>"+ results.rows.item(i).kword+ "</td><td>" + results.rows.item(i).eword +"</td></tr>" ;
}
display(data);
}
// Transaction error callback
//
function errorCB(err) {
alert("Error processing SQL: "+err.code);
}
// Transaction success callback
//
function successCB() {
var db = window.openDatabase("Database", "1.0", "Vocabulary", 200000);
db.transaction(queryDB, errorCB);
}
// PhoneGap is ready
//
function onDeviceReady() {
var db = window.openDatabase("Database", "1.0", "Vocabulary", 200000);
db.transaction(populateDB, errorCB, successCB);
}
function display(data){
$('table#vocab').css('display','block');
$('table#vocab tbody').append(data);
}
</script>

You have an encoding problem. You seem to have '점심' saved properly in UTF8 but displayed in Windows Latin 1. Your issue is on the display side of things. We'd need to see more code...
Your code is fine -- this is the storage part and I knew it was alright anyway. As I said above it's a display issue. Do you set a charset meta tag in the <head> part of your web page?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With