简体   繁体   中英

How to save unicode string into datastore google appengine using java

I'm working Google App Engine using Java, i receive data from form fields and save into datastore. I receive Unicode string from HttpServletRequest like this:

URLDecoder.decode(request.getParameter("text"),"UTF-8")

It returns Unicode string correctly, then i save this string into datastore

DatastoreService datastore = DatastoreServiceFactory.getDatastoreService();
Entity entity = new Entity("TextEntity");
entity.setProperty("text", URLDecoder.decode(
                req.getParameter("name"), "UTF-8"));
entity.setProperty("createdOn", new Date());
datastore.put(entity);

I saw as picture below: 在此处输入图片说明在此处输入图片说明

As you can see, the text field with unreadable characters. How can I solve this problem? Please help me out.

It is a problem with the datastore viewer of the development server. I just ran into this exact same problem, but on the production server, the values are OK.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM