i have problem regarding encoding.
i created mysql 5.5 db containing text. create java webservice creates json read android application.
i have stored text in db , looks good, example :
verwarm de oven voor op 210°c
but when check json in browser looks (and in android app)
{"gerechtid":"6","id":"13","laatsteupdate":"2013-02-14t15:53:42+01:00","text":"verwarm de oven voor op 210°c","titel":"oven voorverwarmen","volgnr":"1"}
as can see, temperature showing characters don't ;-)
how can avoid ?
i'm using hibernate 3 reading db. here persistence.xml :
<?xml version="1.0" encoding="utf-8"?> <persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd "> <persistence-unit name="lengo" transaction-type="resource_local"> <provider>org.hibernate.ejb.hibernatepersistence</provider> <properties> <property name="hibernate.archive.autodetection" value="class, hbm"/> <property name="hibernate.connection.url" value="jdbc:mysql://62.213.197.17/lengotoo_autikoken?autoreconnect=true&useunicode=true&characterencoding=utf-8"/> <property name="hibernate.connection.driver_class" value="com.mysql.jdbc.driver"/> <property name="hibernate.dialect" value="org.hibernate.dialect.mysqldialect"/> </properties> </persistence-unit> </persistence>
i solved question doing :
@produces(mediatype.application_json + "; charset=utf-8") instead of
@produces(mediatype.application_json) in resources of webservice.
Comments
Post a Comment