• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
  • Bear Bibeault
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • salvin francis
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Frits Walraven
  • Jj Roberts
  • Carey Brown
  • Scott Selikoff

saving chinese data to text file

Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,

I am sending some "chinese" data through form post from jsp file to some servlet.
This as fine I an sending proper UTF8 enconing formant.

But my problem is in the servlet how can I fetch this form data and save it to text file on my file system.
when I am saving it to file system it is saved as some junk characters.

this is the jsp file I am using for sending data.

<%@ page language="java" contentType="text/html;charset=UTF-8" pageEncoding="UTF-8" %>
<%@ page import="java.net.URLDecoder" %>
<%@ page import="java.net.URLEncoder" %>


<TITLE>My Interface</TITLE>
<meta http-equiv="Content-Type" content="text/html; charset=TH">
<meta http-equiv="Content-Type" content="text/html; charset=tis-620">
<meta http-equiv="Content-Type" content="text/html; charset=window-874">

<form action="my servlet adress." method="post" >

<INPUT type="text" name="rword" maxlength="60">
<INPUT type="Submit" VALUE="Submit">


can u please help me how to fetch this chinese charater in servlet and save to text file so that it will look in proper format.

looking for ur response

Thanks and regards
Posts: 43016
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Several things come to mind that you could investigate. First, since you specify the content type using JSP, remove the various HTML meta tags. I can easily see that confusing the browser. Secondly, do you set the content type of the response before retrieving anything from it? That is to say, after getting values from the response and before writing them to disk, are they OK? Lastly, are you using the proper encoding when writing the values to a file? If you specify no encoding, the default one is used, and that is not UTF-8.
grapes are vegan food pellets. Eat this tiny ad:
the value of filler advertising in 2020
    Bookmark Topic Watch Topic
  • New Topic