How to get UTF-8 Characters from HTML to Java?

Hi everyone, I'm trying to set up an application that will allow display and entry of international data from HTML forms via servlets. The problem is that I can't get the data back into a java string to apply to the DBMS.
I have tried using UTF-8 and specific character sets such as ISO-8859-5 (Russian). I have specified these character sets/encodings as follows:
HTML: meta content-type header charset=xxx and <form accept-charset=xxx
Servlet Response: setLocale(appropriate locale) and setContentType("text/html; charset=xxx") prior to calling response.getWriter()
Servlet Request: setCharacterEncoding("xxx") (e.g. servlet 2.3)
When I use request.getParameter(xxx) I get normal characters (a, b, c) and nothing for international characters or sometimes question marks.
I have also tried various combinations of:
new String(request.getParameter("xxx").getBytes("xxx"),"xxx")
Could someone please point me in the right direction?
TIA

Thanks for all of your suggestions. It still refuses to work.
I entered the following: ���^�E on the HTML form using the Chinese(PRC)keyboard on my Win2K box.
I checked and verified the correct encoding in the servlet request (GB2312 for chinese characters)
request.getParameter(xxx) yields ???
new String(request.getParameter(xxx).getBytes("GB2312")) yields three boxes (values 20309, 27946 and 23380)
new String(request.getParameter(xxx).getBytes("GB2312"), "UTF-8") yields nothing
Any ideas?

Similar Messages

  • Can't get UTF-8 characters from XML file displayed correctly (Cocoa Touch)

    Hi there,
    I'm trying to read an XML file with Japanese and Korean characters (encoded UTF-8) into a String like
    NSString *s = [[NSString alloc] initWithContentsOfURL:[NSURL URLWithString:@"http://.../data1.xml"] encoding:NSUTF8StringEncoding error:&e];
    However, the output just gives me some wrong characters. I also tried use NSData, but the result was the same.
    The same when I parse the XML file with
    NSXMLParser *parser = [[NSXMLParser alloc] initWithContentsOfURL:URL];
    The parser function just gives back gibberish.
    When I write the data into a table cell (cell.text = ...), only the first character is displayed followed by "...".
    Where can I start looking to get this right? I'm not so experienced in Cocoa yet, so I feel that I'm missing something simple here...
    Thanks,
    Thomas

    I think so (haven't checked), but it is a really simple test xml which is not really error prone).
    But the problem is a different one, because I also just tried to read a txt file with some Japanese characters into an NSString using initWithContentsOfURL.
    When I print the string in the console, I only get messed up characters (the latin characters next to the Japanese are displayed fine).
    It is a general problem of reading out an UTF-8 file from an url.
    Spent the whole last night to google something helpful but couldn't find anything. Now I'm tired at work
    Thomas

  • How to get ISO-8859 characters from DOM ?

    Hi,
    I have problems to get the ISO-8859 characters from the DOM. I parse a XML file and read the values from the DOM. All "umlauts" are scrambled.
    The details:
    The first line of the XML file is:
    <?xml version="1.0" encoding="ISO-8859-1"?>
    It contains lines like:
    <tag>Dpfel</tag>
    I perform the following steps:
    I'm parsing the XML file ...
    xmlparser.parse( parser, full_fname_xml );
    ... get the document ...
    doc := xmlparser.getDocument( parser );
    ... and read the value from the TEXT_NODE:
    nodevalue := xmlparser.getNodeValue( node );
    And here is the problem: nodevalue does
    not contain 'Dpfel' but '?pfel'.
    Its not a problem of the database. Explizit INSERTs with "umlauts" e.g. are working fine.
    This problem occurs with the XML Parser for PLSQL 1.0.0.1.0 on NT.
    [Pls do not recommend to use the newer version. I did a test with the newer version and know it works there.]
    My questions relates only to this older version:
    Will it never work with this version
    or what am I doing wrong ?
    Any hints welcome !
    Tnx
    Franz
    null

    Tnx for the quick answer.
    Sorry, indeed I can not use the newer
    version in the moment.
    So I urgently need a solution or any
    workaround for this version.
    F.

  • How to get the file path from HTML input form in Firefox 3...

    In IE7 (and probably all famous browsers, including old Firefox 2), if we submit a file like 'C:\folder1\folder2\folder3\filename' it works properly and gives the full path to the file and the filename.
    In Firefox 3, it returns only 'filename', because of their new 'security feature' to truncate the path, as explained in Firefox bug tracking system (https://bugzilla.mozilla.org/show_bug.cgi?id=143220)
    I have no clue how to overcome this 'new feature' because it causes all upload forms in my webapp to stop working on Firefox 3.
    Can anyone help to find a single solution to get the file path both on Firefox 3 and IE7?
    Thanks in advance....

    As you're posting this in the JSF forum and looking at your [previous topic|http://forums.sun.com/thread.jspa?threadID=5342365], I assume that you're using Tomahawk's t:inputFileUpload. In this case, just use UploadedFile#getInputStream(). You may find this article useful: [http://balusc.blogspot.com/2008/02/uploading-files-with-jsf.html].
    By the way, are you lazy or just dumb? You wasted one week to this! I've posted the aforementioned article one week ago. How did you stuck?

  • How to get 4 first characters from a full name ?

    Hello,
    in my database I can choose the value Last_Name; this generates the full last name of someone. In a DECODE I would only like to get the first 4 characters of the Last_Name.
    How can I make this in a DECODE ?
    Thanks for you help.
    Anouk

    I was searching for the wrong thing I guess....
    Your solution works perfect; thanks!
    Greetings,
    Anouk

  • How to get the file path from HTML input form in Firefox3

    In IE7 (and probably all famous browsers, including old Firefox 2), if we submit a file like 'C:\folder1\folder2\folder3\filename' it works properly and gives the full path to the file and the filename.
    In Firefox 3, it returns only 'filename', because of their new 'security feature' to truncate the path, as explained in Firefox bug tracking system (https://bugzilla.mozilla.org/show_bug.cgi?id=143220)
    I have no clue how to overcome this 'new feature'.
    Can anyone help to find a single solution to get the file path both on Firefox 3 and IE7?
    Thanks in advance....

    Doubleposted and ignored any previous answer: [http://forums.sun.com/thread.jspa?threadID=5342405]. Don't do that. It's rude.
    Regarding to your "problem": why do you need the file path?

  • How to get Stored Proc name from ReportClientDoc object (java)

    Post Author: cpriyanka
    CA Forum: Exporting
    We are using Crysta Report 9 and Java.
    We create ReportClientDocument by mentioning report template name ("rassdk://" + report template file path).
    Once I open ReportClientDocument, is there way I can get stored procedure name that is used (associated to report template) to get data in report.
    Thanks,
    Priyanka

    Post Author: cjmorris1201
    CA Forum: Exporting
    Priyanka,
    I am not too sure about the ReportClientDocument and java.
    Where I work we use 8.5, .Net.  We use ttx files to define our data source. 
    I can use something similar to below to retrieve the ttx name programmatically.  Perhaps you can use something similar:
    oCrystalSession.oRpt.Database.Tables.Item(1).Name
    Good luck!

  • How to get the extension Info from firefox? Do we have any firefox API to communicate with the browser? I couldnt see the HTML of the widget displayed in the toolbar how to access the widget using JS or any way

    How to get the extension Info from firefox? Do we have any firefox API to communicate with the browser? I couldnt see the HTML of the widget displayed in the toolbar how to access the widget using JS or any way

    Hi,
    Thanks for the suggestion. I've been playing around with some of the classes of the java.net package and java.io
    Using the URL class i can get the content of the data from a STATIC page and output that response to file so that is does not display to the client broswer.
    But this only works if the URL i give points to a static html page.
    So the problem i'm getting is if i'm righting in arguments in the URL, this means that server needs to process the arguments i give and its sends back a dynamic result. Because its dynamic the URL class can not handle this and throws me an exception everytime :(
    Have u ever tried to do some things like this?
    Rahul

  • How to get UTF-8 encoding when create XML using DBMS_XMLGEN and UTL_FILE ?

    How to get UTF-8 encoding when create XML using DBMS_XMLGEN and UTL_FILE ?
    Hi,
    I do generate XML-Files by using DBMS_XMLGEN with output by UTL_FILE
    but it seems, the xml-Datafile I get on end is not really UTF-8 encoding
    ( f.ex. cannot verifying it correct in xmlspy )
    my dbms is
    NLS_CHARACTERSET          = WE8MSWIN1252
    NLS_NCHAR_CHARACTERSET     = AL16UTF16
    NLS_RDBMS_VERSION     = 10.2.0.1.0
    I do generate it in this matter :
    declare
    xmldoc CLOB;
    ctx number ;
    utl_file.file_type;
    begin
    -- generate fom xml-view :
    ctx := DBMS_XMLGEN.newContext('select xml from xml_View');
    DBMS_XMLGEN.setRowSetTag(ctx, null);
    DBMS_XMLGEN.setRowTag(ctx, null );
    DBMS_XMLGEN.SETCONVERTSPECIALCHARS(ctx,TRUE);
    -- create xml-file:
    xmldoc := DBMS_XMLGEN.getXML(ctx);
    -- put data to host-file:
    vblob_len := DBMS_LOB.getlength(xmldoc);
    DBMS_LOB.READ (xmldoc, vblob_len, 1, vBuffer);
    bHandle := utl_file.fopen(vPATH,vFileName,'W',32767);
    UTL_FILE.put_line(bHandle, vbuffer, FALSE);
    UTL_FILE.fclose(bHandle);
    end ;
    maybe while work UTL_FILE there is a change the encoding ?
    How can this solved ?
    Thank you
    Norbert
    Edited by: astramare on Feb 11, 2009 12:39 PM with database charsets

    Marco,
    I tryed to work with dbms_xslprocessor.clob2file,
    that works good,
    but what is in this matter with encoding UTF-8 ?
    in my understandig, the xmltyp created should be UTF8 (16),
    but when open the xml-file in xmlSpy as UTF-8,
    it is not well ( german caracter like Ä, Ö .. ):
    my dbms is
    NLS_CHARACTERSET = WE8MSWIN1252
    NLS_NCHAR_CHARACTERSET = AL16UTF16
    NLS_RDBMS_VERSION = 10.2.0.1.0
    -- test:
    create table nh_test ( s0 number, s1 varchar2(20) ) ;
    insert into nh_test (select 1,'hallo' from dual );
    insert into nh_test (select 2,'straße' from dual );
    insert into nh_test (select 3,'mäckie' from dual );
    insert into nh_test (select 4,'euro_€' from dual );
    commit;
    select * from nh_test ;
    S0     S1
    1     hallo
    1     hallo
    2     straße
    3     mäckie
    4     euro_€
    declare
    rc sys_refcursor;
    begin
    open rc FOR SELECT * FROM ( SELECT s0,s1 from nh_test );
    dbms_xslprocessor.clob2file( xmltype( rc ).getclobval( ) , 'XML_EXPORT_DIR','my_xml_file.xml');
    end;
    ( its the same when using output with DBMS_XMLDOM.WRITETOFILE )
    open in xmlSpy is:
    <?xml version="1.0"?>
    <ROWSET>
    <ROW>
    <S0>1</S0>
    <S1>hallo</S1>
    </ROW>
    <ROW>
    <S0>2</S0>
    <S1>straޥ</S1>
    </ROW>
    <ROW>
    <S0>3</S0>
    <S1>m㢫ie</S1>
    </ROW>
    <ROW>
    <S0>4</S0>
    <S1>euro_€</S1>
    </ROW>
    </ROWSET>
    regards
    Norbert

  • How to get all the values from the dropdown menu

    How to get all the values from the dropdown menu
    I need to be able to extract all values from the dropdown menu; I know how to get all those values as a string, but I need to be able to access each item; (the value in a dropdown menu will change dynamically)
    How do I get number of item is selection dropdown?
    How do I extract a ?name? for each value, one by one?
    How do I change a selection by referring to particular index of the item in a dropdown menu?
    Here is the Path to dropdown menu that I'm trying to access (form contains number of similar dropdowns)
    RSWApp.om.GetElementByPath "window(index=0).form(id=""aspnetForm"" | action=""advancedsearch.aspx"" | index=0).formelement[SELECT](name=""ctl00$MainContent$hardwareBrand"" | id=""ctl00_MainContent_hardwareBrand"" | index=16)", element
    Message was edited by: testtest

    The findElement method allows various attributes to be used to search. Take the following two examples for the element below:
    <Select Name=ProdType ID=testProd>
    </Select>
    I can find the element based on its name or any other attribute, I just need to specify what I am looking for. To find it by name I would do the following:
    Set x = RSWApp.om.FindElement("ProdType","SELECT","Name")
    If I want to search by id I could do the following:
    Set x = RSWApp.om.FindElement("testProd","SELECT","ID")
    Usually you will use whatever is available. Since the select element has no name or ID on the Empirix home page, I used the onChange attribute. You can use any attribute as long as you specify which one you are using (last argument in these examples)
    You can use the FindElement to grab links, text boxes, etc.
    The next example grabs from a link on a page
    Home
    Set x = RSWApp.om.FindElement("Home","A","innerText")
    I hope this helps clear it up.

  • How to get the return values from a web page

    Hi all :
       how to get the return values from a web page ?  I mean how pass values betwen webflow and web page ?
    thank you very much
    Edited by: jingying Sony on Apr 15, 2010 6:15 AM
    Edited by: jingying Sony on Apr 15, 2010 6:18 AM

    Hi,
    What kind of web page do you have? Do you have possibility to for example make RFCs? Then you could trigger events (with parameters that could "return" the values) and the workflow could react to those events. For example your task can have terminating events.
    Regards,
    Karri

  • How to get warranty service claim from nokia c5-03...

    how to get warranty service claim from nokia c5-03 in india because i have problem with nokia c5-03 I Purchase 2 week ago a new nokia c5-03 but from day 1 i facing same problem like 1) app close itself 2) internet browse close if any thing is downloading or downloading over 3) memory full always then i should reboot the phone then it work. 4) ovi map is open it shows memory full close the app So kindly help me how to get warranty service claim from nokia c5-03 in india i am unhappy with nokia c5-03
    Solved!
    Go to Solution.

    i updated software also but the same problem cont... I want to know that nokia will give back money or exchange for other new mobile

  • For some reason the system is telling me my birth date is wrong when it's not and it won't let me proceed to reset my password. Can someone tell me how to get a "real" person from tech on line?

    For some reason the system is telling me my birth date is wrong when it's not and it won't let me proceed to reset my password. Can someone tell me how to get a "real" person from tech on line?

    contact itunes support

  • How to get the current week from sysdate?

    Hi sir,
    i want to know how to get the current week from sysdate?
    thanks

    Hi Nicolas
    It seems you like to check my post and also make commend ;) thanks for your attention
    Have you ever read the posts above and given solutions ?Yes, I did
    Have you read the docs ? Yes, I checked
    What's the added value here ?Did youYou shared doc with solution(long one), I shared short one which point same solution(Check what Joel posted)..So what is benefit, As you can guess oracle docs are sometimes become so complicated as specialy for beginner...(At least it was like that for me and Belive me somedocs are still sooo complicated even for oracle coworkers ) But for you I dont know ;)
    => Why writting the PS in bold ?Why.. Let me think... Ohh Maybe I am looking some questions(many) and even user get answer they should not changed status so I am reading some posts and try to get problem and loosing time..
    So I am putting that PS wiht BOLD because I dont wanna lose time my friend ;) Because While I am trying to help ppl here In same time I am trying to giving support to my customer prod systems. Which mean time is very important for me...
    Hope my answer could satisfy you..
    One important PS for you.. You may not like my posts (or someone) but my friend I become tired to read&answer and make commend to on your comment which is about my posts.
    I am not newbie in forum(At least I fell like that) and I belive I know how I should make post..
    Thank you
    Regards
    Helios

  • How to get the selection parameters from logical database into one of the t

    Hi Sap ABAP Champians,
    How to get the selection parameters from logical database into one of the tab in the tabstrip selection-screen.
    Please help me for this
    Thanks
    Basu

    Hi
    Thanks, that will work, but then I'll have to insert code into all my reports.
    I can see that "Application Server Control Console" is able to rerun a report.
    This must mean that the Report Server has access to the runtime parameters.
    But how?
    Cheers
    Nils Peter

Maybe you are looking for

  • Enabling Acrobat Toolbars in C#

    I am using WPF to display PDF documents in my application.  I load my documents using the following code:     public partial class AdobePDFViewer : UserControl         public AdobePDFViewer(string path)             InitializeComponent();            

  • How do i get avi's to play in quick look and the preview bar?

    I have a MBP and i was wondering if i can get finder/Quicklook to play AVI's im pretty sure my old MB did it find but my MBP wont? Any ideas? cheers, Sam

  • Replacing LE with Logic Pro: uninstall?

    When I bought LE I installed it on both my home iMac and my iBook G4 (so I could do some work while traveling). Now I've bought Pro, so I plan to keep LE on my iBook, and I want to install Pro on the iMac. • Do I need to uninstall the iMac's LE? • If

  • Comment toolbars in Acrobat Reader apparently changing in a Random fashion

    I am coming across a problem with Reader Extension Enabled documents that are produced from Adobe Livecycle. On occasions the comment and markup tool bar changes with certain tools (notably the sticky note) appearing and others (Attach comment as fil

  • Can I back-up my iPod Touch without syncing?

    I use my iPod mainly for podcasts, which I don't want to keep once I've listened to them. Now that I can download them via wifi and delete them right on the iPod, I see no reason to download the podcasts to iTunes. But I still would like to back-up m