Why are my foreign language (malayalam) characters stored as html characters in the database

on my website using google goi language i type malayal language in textbox and text area,

ഇതു ഒരു നല്ല സിനിമ ആണ്

like this, but when I look into mySQL database the table is

    ഇതു ഒരു 
നല്ല സിനിമ 
ആണ്  

      

and there is no problem to view it on my website, but I am using this same table data for my desktop application and in this application when fetching data from db, it shows as ഇതു ഒരു നല്ല സിനിമ ആണ്


 not in my native language if I do a manual update using SQL query on the database, then both the website and my desktop app show it correctly in my local language, my web server is tomcat. and my db is mySQL db and db is utf.

what should i do in my java application to save direclty in local language other than സ

..etc.

+2


source to share


5 answers


You need to make sure your web page is UTF-8 encoded and declared in the HTTP Content-Type header. Otherwise, the web browser may choose to send HTML escaped characters when characters are entered outside the encoding of the intended page.



+5


source


Use Unicode encoding at the beginning

HTML5

<meta charset="utf-8">

      

HTML 4.01

<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

      



xhtml 1.0

<meta http-equiv="content-type" content="text/html;charset=utf-8" />

      

XML

<?xml version="1.0" encoding="UTF-8"?>

      

+1


source


Stop HTML eluding your data. But keep working with the database.

0


source


Something in your site code could very well be HTML character encoding before storing them in the database.

See exactly how your rows are represented just before inserting / updating the database. If necessary, HTMLDecode the data before inserting it into the database.

0


source


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"> 

      

Mallu ഇതു ഒരു നല്ല സിനിമ ആണ്

-1


source







All Articles