Register / Login
Win a copy of
Think Java: How to Think Like a Computer Scientist
this week in the
Java in General
Retrieve non English symbols from request
posted 5 years ago
Hello to all,
I would like to ask you for some help. I have GET form which submits data /parameters/
. So far so good... but the parameters data are not in English /actually in Cyrillic/.
So, how can I just write those parameters in a text file? What I have tried:
request.setCharacterEncoding("UTF8"); // here I've used many others encoding strings such as UTF-16, Cp1252... FileWriter file = new FileWriter("test.txt"); file.write(request.getParameter("F_Name")); // doesn't work. In the text file is like ????????? // so I decide to use OutputStreamWriter just to be able to change the stream encoding File f = new File("test.txt"); FileOutputStream fw = new FileOutputStream(f); OutputStreamWriter f_out = new OutputStreamWriter(fw,"Cp1252"); // I've used many others encodings as well // still the text file is like ????????
Does anyone have already been down this road?
How to parse an XML document containing Chinese characters and get an XML bean
Output French Characters to a file
FileWriter & UTF-8 Encoding