JSP display problem with UTF-8 encoding

Hi,
I'm now writing JSP in order to input English, Traditional Chinese and Simplifed Chinese in the same form of the page. I've set the encoding as below:
<head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> </head>
When, I get the user input in the next page, those Chinese become some squares, "?" or strange codes. However, when these data are store into database, and loaded from database, they display correctly in Chinese. That means I cannot get the string correctly directly from getParameter("") in next page.
What can I do to fix this problem. Thank you so much!
Zoe

What is your environment (JDK, Server, DB)?
Try add this line to the top of your next page to set the encoding character set. Otherwise, it will default to ISO-8859-1 which gives the chinese characters ??? when you try to display them.
<%request.setCharacterEncoding("utf-8");%>
Regards
-WK-

Similar Messages

  • Message Mapping Problem with UTF-16LE Encoded XML

    Hello,
    we have the following scenario:
    IDoc > BPM > HTTP Sync Call > BPM > IDoc
    Resonse message of the HTTP call is a XML file with UTF-16LE processing instruction. This response should then be mapped to a SYSTAT IDoc. However the message mapping fails "...XML Parser: No data allowed here ...".
    So obviously the XML is not considered as well-formed.
    When taking a look at SXMB_MONI the following message appears: "Switch from current encoding to specific encoding not supported.....".
    Strange thing however is if I save the response file as XML and use the same XML file in the test tab message mapping is executed successfully.
    I also tried to use a Java Mapping to switch encodings before executing message mapping, but the error remains.
    Could the problem be, that the codepage UTF-16LE is not installed on the PI system ? Any idea on that ?
    Thank you!
    Edited by: Florian Guppenberger on Feb 2, 2010 2:29 PM
    Edited by: Florian Guppenberger on Feb 2, 2010 2:29 PM

    Hi,
    thank your for your answer.
    This is what I have tried to achieve. I apply the java conversion mapping when receiving the response message - i tried to convert the response to UTF-16, UTF-8 but none of them has helped to solve the problem.
    I guess that using adapter modules is not an option either as it would modify the request message, but not the response, right?

  • Having problems with UTF-8 encoding from WinPhone

    Our sync server (GroupWise Mobility Server) - which supports EAS 14 - is failing to sync an item from a Windows Phone to our email application's calendar.
    As we look at the .ics file created by the Windows Phone, we notice that some characters are not UTF-8 characters as claimed (see .ics file below) and thus, do not decode properly and we drop the sync request.
    .ics file contents:
    BEGIN:VCALENDAR
    METHOD:REQUEST
    PRODID:Microsoft Windows Phone
    VERSION:2.0
    BEGIN:VTIMEZONE
    TZID:Öйú±ê׼ʱ¼ä
    BEGIN:STANDARD
    DTSTART:20000101T000000
    TZOFFSETFROM:+0800
    TZOFFSETTO:+0800
    END:STANDARD
    END:VTIMEZONE
    BEGIN:VEVENT
    SUMMARY;CHARSET=UTF-8:好吧
    DESCRIPTION;CHARSET=UTF-8:我们俩人呢
    CLASS:PUBLIC
    LOCATION;CHARSET=UTF-8:嗯嗯
    UID:040000008200E00074C5B7101A82E00800000000B0AE9BBDCCB0E642A1A016ED65B5498
     0100000001A7F45FD22126646A347826899970D56
    DTSTART;TZID=Öйú±ê׼ʱ¼ä:20141024T160000
    DTEND;TZID=Öйú±ê׼ʱ¼ä:20141024T170000
    X-MICROSOFT-DISALLOW-COUNTER:FALSE
    X-MICROSOFT-CDO-ALLDAYEVENT:FALSE
    STATUS:CONFIRMED
    ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=DELEGATED;CN=¨¹?? ¨¹??:MAILTO:deu02@
     mydo43.com
    ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;CN=user01 user01:MAILTO
     :[email protected]
    ORGANIZER:MAILTO:[email protected]
    DTSTAMP:20141024T075407Z
    LAST-MODIFIED:20141024T075407Z
    BEGIN:VALARM
    ACTION:DISPLAY
    DESCRIPTION:REMINDER
    TRIGGER:-PT15M
    END:VALARM
    END:VEVENT
    END:VCALENDAR

    We just took the Content-Type text/calendar portion, decoded it and this is what we were referring to as the meeting.ics.  
    Here is the MIME that the Windows 8 Phone sends:
    MIME-Version: 1.0
    To: =?utf-8?Q?=C3=BC=C3=B6=C3=A4_=C3=BC=C3=B6=C3=A4?= <[email protected]>,
            user01 user01 <[email protected]>
    Subject: =?utf-8?B?5aW95ZCn==?=
    Date: Fri, 24 Oct 2014 15:54:07 +0800
    Thread-Topic: =?utf-8?Q?=E5=A5=BD=E5=90=A7?=
    Content-Type: multipart/alternative;
            boundary="_6504CEF0-3696-4407-8129-C93E3F2622A6_"
    X-GWTO-BUFFER: =?utf-8?Q?=C3=BC=C3=B6=C3=A4_=C3=BC=C3=B6=C3=A4?=; user01 user01
    --_6504CEF0-3696-4407-8129-C93E3F2622A6_
    Content-Transfer-Encoding: base64
    Content-Type: text/plain; charset="utf-8"
    5oiR5Lus5L+p5Lq65ZGi
    --_6504CEF0-3696-4407-8129-C93E3F2622A6_
    Content-Type: text/calendar; charset="utf-8"; method=REQUEST
    Content-Transfer-Encoding: base64
    QkVHSU46VkNBTEVOREFSDQpNRVRIT0Q6UkVRVUVTVA0KUFJPRElEOk1pY3Jvc29mdCBXaW5kb3dz
    IFBob25lDQpWRVJTSU9OOjIuMA0KQkVHSU46VlRJTUVaT05FDQpUWklEOtbQufqx6te8yrG85A0K
    QkVHSU46U1RBTkRBUkQNCkRUU1RBUlQ6MjAwMDAxMDFUMDAwMDAwDQpUWk9GRlNFVEZST006KzA4
    MDANClRaT0ZGU0VUVE86KzA4MDANCkVORDpTVEFOREFSRA0KRU5EOlZUSU1FWk9ORQ0KQkVHSU46
    VkVWRU5UDQpTVU1NQVJZO0NIQVJTRVQ9VVRGLTg65aW95ZCnDQpERVNDUklQVElPTjtDSEFSU0VU
    PVVURi04OuaIkeS7rOS/qeS6uuWRog0KQ0xBU1M6UFVCTElDDQpMT0NBVElPTjtDSEFSU0VUPVVU
    Ri04OuWXr+WXrw0KVUlEOjA0MDAwMDAwODIwMEUwMDA3NEM1QjcxMDFBODJFMDA4MDAwMDAwMDBC
    MEFFOUJCRENDQjBFNjQyQTFBMDE2RUQ2NUI1NDk4DQogMDEwMDAwMDAwMUE3RjQ1RkQyMjEyNjY0
    NkEzNDc4MjY4OTk5NzBENTYNCkRUU1RBUlQ7VFpJRD3W0Ln6serXvMqxvOQ6MjAxNDEwMjRUMTYw
    MDAwDQpEVEVORDtUWklEPdbQufqx6te8yrG85DoyMDE0MTAyNFQxNzAwMDANClgtTUlDUk9TT0ZU
    LURJU0FMTE9XLUNPVU5URVI6RkFMU0UNClgtTUlDUk9TT0ZULUNETy1BTExEQVlFVkVOVDpGQUxT
    RQ0KU1RBVFVTOkNPTkZJUk1FRA0KQVRURU5ERUU7Uk9MRT1SRVEtUEFSVElDSVBBTlQ7UEFSVFNU
    QVQ9REVMRUdBVEVEO0NOPai5Pz8gqLk/PzpNQUlMVE86ZGV1MDJADQogbXlkbzQzLmNvbQ0KQVRU
    RU5ERUU7Uk9MRT1SRVEtUEFSVElDSVBBTlQ7UEFSVFNUQVQ9TkVFRFMtQUNUSU9OO0NOPXVzZXIw
    MSB1c2VyMDE6TUFJTFRPDQogOnVzZXIwMUBteWRvNDMuY29tDQpPUkdBTklaRVI6TUFJTFRPOmRl
    dTAyQG15ZG80My5jb20NCkRUU1RBTVA6MjAxNDEwMjRUMDc1NDA3Wg0KTEFTVC1NT0RJRklFRDoy
    MDE0MTAyNFQwNzU0MDdaDQpCRUdJTjpWQUxBUk0NCkFDVElPTjpESVNQTEFZDQpERVNDUklQVElP
    TjpSRU1JTkRFUg0KVFJJR0dFUjotUFQxNU0NCkVORDpWQUxBUk0NCkVORDpWRVZFTlQNCkVORDpW
    Q0FMRU5EQVINCg==
    --_6504CEF0-3696-4407-8129-C93E3F2622A6_--
    When you decode the text/calendar data, this is where you will find the characters that are not valid UTF-8.

  • [SOLVED] Problems opening folders with UTF-8 encoded characters

    Hello everyone, I'm having an issue when I acess folders in all my programs ( except Dolphin File Manager). Every time I open the folder navigation window in my programs, folders with UTF-8 encoded characters ( such as "ç", "á ", "ó", "í", etc ) are not shown or the folder name not show these characters, therefore, I can not open documents inside these folders.
    However, as you saw, I can type these characters normally. Here's my "locale.conf" :
    LANG="en_US.UTF-8:ISO-8859-1"
    LC_TIME="pt_BR.UTF-8:ISO-8859-1"
    And here's the output of the command "locale -a" :
    C
    en_US.utf8
    POSIX
    Last edited by regmoraes (2015-04-17 12:55:19)

    Thing is, when I run locale -a, I get
    $ locale -a
    C
    de_DE@euro
    de_DE.iso885915@euro
    de_DE.utf8
    en_US
    en_US.iso88591
    en_US.utf8
    ja_JP
    ja_JP.eucjp
    ja_JP.ujis
    ja_JP.utf8
    japanese
    japanese.euc
    POSIX
    So an entry for every locale I have uncommented in my locale.conf. Just making sure, by "following the steps in the beginner's guide", you also mean running locale-gen?
    Are those folders on a linux filesystem like ext4 or on a windows (ntfs?)

  • [svn:fx-trunk] 7661: Change from charset=iso-8859-1" to charset=utf-8" and save file with utf-8 encoding.

    Revision: 7661
    Author:   [email protected]
    Date:     2009-06-08 17:50:12 -0700 (Mon, 08 Jun 2009)
    Log Message:
    Change from charset=iso-8859-1" to charset=utf-8" and save file with utf-8 encoding.
    QA Notes:
    Doc Notes:
    Bugs: SDK-21636
    Reviewers: Corey
    Ticket Links:
        http://bugs.adobe.com/jira/browse/iso-8859
        http://bugs.adobe.com/jira/browse/utf-8
        http://bugs.adobe.com/jira/browse/utf-8
        http://bugs.adobe.com/jira/browse/SDK-21636
    Modified Paths:
        flex/sdk/trunk/templates/swfobject/index.template.html

    same problem here with wl8.1
    have you sold it and if yes, how?
    thanks

  • [Solved] Automount Generic MP3 Player with UTF-8 encoding

    Hello, everybody!
    Ubuntu refugee here.
    So far I'm going fine with Arch, I just have a couple of problems related to my Generic USB Mp3 player:
    1) I want HAL to mount the player with UTF-8 encoding. Right now, it shows Arabic characters as ??????.
    2) In Ubuntu, it used to recognize the player as an MP3 player, give it a nice icon, and add it as a music source in Rhythmbox. In Arch, on the other hand, the player is mounted as a generic USB flash drive. How can I make Arch recognize it as an MP3 player?
    Thanks in advance.
    Last edited by farghal (2008-05-10 20:17:09)

    GOT IT WORKING!! Yay!
    I got the solution from here:
    http://blog.pcode.nl/2006/08/24/introdu … io-player/
    The trick is to make HAL identify your Digital Audio Player (DAP) by adding a rule to /usr/share/hal/fdi/information/10freedesktop/10-usb-music-players.fdi  --  and since, in my case, Ubuntu already had a 10-usb-music-players.fdi file that recognized my player, all I had to do was boot up from an Ubuntu live cd and copy Ubuntu's 10-usb-music-players.fdi over Arch's.
    Now my issues with Arch are down to only one: http://bbs.archlinux.org/viewtopic.php?pid=360647
    Thanks everybody.
    Last edited by farghal (2008-05-10 20:16:49)

  • Display Problem with my Mac Pro and LG Flatron Wide Monitor in Mountain Lion

    After upgrading to Mountain Lion, my Mac Pro has display problems with my LG Flatron display.  The image is displayed with a black bar on the right and on the bottom.  And the left side of the content is not visible.  I tried every resolution available in the Display System Preferences, they are different in terms of how big the black bars are, and what part is not visible, but none of them are correct.  I held down the option key to try to detect displays or switch to resolutions that are not normally available.  When I restart the image is lined up with the display, but if the display ever goes to sleep or gets turned off, the image reverts to being off center, and the only way I can get it back is to restart...  The interesting thing is that this monitor works fine with the same machine if I reboot using BootCamp into Windows 7.  The Monitor also works fine, connecting the same connector to a Mac Mini, although that mac mini is running 10.6 and not Mountain Lion.  I've reset the SMC and restarted countless times, I don't see any other levers to pull or things to try...

    That card is for a PC it may not give you Startup and Option-Boot screens.
    The 7950 "Mac Edition" card has a very distinctive look:
    http://www.sapphiretech.com/presentation/product/product_index.aspx?cid=1&gid=3& sgid=1157&pid=1777&psn=&leg=0&lid=1

  • Could not complete the Render Video command because of a problem with Adobe Media Encoder.

    So initially, my problem was solved, but it stopped working again.  Same issue.  I tried installing the media encoder app, but no luck please help!
    Here's the original post:
    Hello, I'm running a macbook pro retina, and previously I was able to render video with no issue, and now this is popping up.  I've tried deleting and reinstalling photoshop, but it was not helpful. I would very much appreciate any help or guidance.  Thanks!
    Here's the error message I get:
    Could not complete the Render Video command because of a problem with Adobe Media Encoder.
    Here's the original thread: Could not complete the Render Video command because of a problem with Adobe Media Encoder.

    Have you tried re-installing Photoshop?
    Benjamin

  • External Display Problem with x301

    Hi everybody,
    I have a external display Problem with my x301.
    Ether direct attachment or via Lenovo USB Display Port  Device, the external monitor (22" Benq LCD) starts to flickr after a couple of minutes and the external display shuts off.
    Any ideas on this?
    Thanks a lot
    Chris 

    i have the same problem with X200 and the X200 ultrabay Docking station.
    No idea yet ...

  • How to write csv or txt file through utl_file with UTF-8 Encoding

    Hi All,
    I need your help to write the data from DB to csv or txt file with UTF-8 encoding through utl_file.
    Database character set:AL32UTF8
    Database version:10G
    All the columns in the DB are of varchar2 type.
    Please let me know if there is any way of doing it.

    What was wrong with the info provided in the link(s) given?
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/functions027.htm#SQLRF00620]

  • Are the problems with Compressor's encoding fixed yet?

    Sorry for the slightly vague title but I only use compressor once a year basically, which is after the production of a Christmas show I produce. Last year I upgraded ot Final Cut Studio to do the DVD and got caught out. I encoded using what I thought was the best setting (2 pass variable bit rate) and got jittery encoding. After investigating on this very forum, I found lots of comments about known problems with Compressor's encoding in this setting and ended up re encoding using one pass which was "ok".
    I'd rather do the best job I can so the basic question is, "is it fixed yet". Keeping in mind I understand about altering settings so that I can get the time I need onto one disc (110 minutes unfortunately!) What setting will offer me the best possible picture quality, regardless of encoding time, with compressor? Many, many thaks for any advice you regular user can offer!!
    Happy Christmas in advance, Gareth

    Gareth:
    According what was posted in this thread:
    http://discussions.apple.com/thread.jspa?threadID=760041&tstart=15
    by Brian a lot of problems must be solved using the last 2.3 version.
    Hope it helps !
      Alberto

  • Display problems with Kwin on intel hardware

    Hi all,
    Since the latest update of xorg and intel drivers, I have a display problem with kwin's expose-like feature. Before I file a bug,
    - Is anyone experiencing the same problem? Do you have a workaround?
    - Does anyone know what could be at fault?

    lardon wrote:
    panosk wrote:Indeed... If you want to fill a bug report right now go ahead, otherwise I have to get to my laptop in a few hours to check logs and post a report then. BTW, could you also try Ctrl+F11 and rotate the cube for a while? You should notice some flashes and very bad performance, even with direct rendering.
    I will, and I hope you'll contribute your logs to the bug report! The question is where to submit it: I'm pretty sure the bug is upstream, but is it a kwin bug or an xorg/intel bug?
    Ctrl+F11 works "fine" on my system, even though it crashed kwin the first time I tried it :-)
    Well, that's a very tough question! I was thinking to fill a bug report in Arch's bugtracker, although I also think it is an upstream bug. Problem is, after reading this http://blog.martin-graesslin.com/blog/2 … paces-4-5/ and this http://www.itnewstoday.com/?p=1803, one can realize the absolute *Mes(s)a * that dominates the whole graphics stack....

  • Please Help - Very strange problem with internal String encoding

    I created a file in one-byte russian encoding cp1251 and declared String literal with 2 letters:
    String str = "ab"; //attention! ab - two russian characters
    After I got bytes from it - str.getBytes("cp1251") - it returned 2 byte's array.
    Now I created a file with UTF-8 encoding with equal content and suddenly:
    After I got bytes from it - str.getBytes("cp1251") - it returned 4! byte's array. Why?
    I need to get a one-byte encoded arrays (cp1251 or koi8-r) but getBytes ALWAYS returns two-byte encoded arrays.
    It is very strange: cp1251 is always one-byte encoded, but .getBytes("cp1251") returns two-byte on each letter. Why? Please help.

    I did not read a string from a file. I created 2 .java files with different encodings (cp1251 and UTF-8) and compiled them, telling compiler with -Dfile.encoding=*** to read them correctly. While execution java interprets two looking equal in editor strings as different objects with different .intern() representation.
    Why java consider source .java file encoding while creating internal representation of String object and creates from looking equally in editor strings two DIFFERENT Unicode representations. And it is impossible to convert one representation to other - impossible to get two equal byte[] arrays.

  • Forwarding with utf-8 encoding

    Hi all,
    I've been having a problem with UTF8 encoding with jdk1.3.
    Here's three simple JSPs that illustrate it:
    MattTest3.jsp
    <%@ page contentType="text/html; charset=utf-8" %>
    <form action=MattTest5.jsp>
    <input type=text name=xxx>
    <input type=submit>
    </form>
    <br>
    <form action=MattTest4.jsp>
    <input type=text name=xxx>
    <input type=submit>
    </form>
    MattTest4.jsp
    <%@ page contentType="text/html; charset=utf-8" %>
    <jsp:forward page='MattTest5.jsp'/>
    MattTest5.jsp
    <%@ page contentType="text/html; charset=utf-8" %>
    <%= request.getParameter("xxx") %>
    The first MattTest3 renders two input boxes with submit buttons. The first input submits to MattTest5, which just prints the value from the request parameter. THe second submits to MattTest4, which does nothing other than forward to MattTest5.
    If I enter "special characters", such as accented letters (e.g. hold AltGr and press a or e), then the first submission displays them as I entered them, and the second (with the forward) displays two question marks for each character entered.
    I'm using iPlanet 4.1sp6 on Solaris 2.7, and only get the bahaviour with jdk1.3. Using jdk1.2, the request parameter gets truncated at the first "special character", which still isn't what I'd expect.
    Does anybody have any ideas? Can anybody replicate the problem? On what platforms? Can anybody NOT replicate the problem? On what platforms?

    try with java.net.URLEncoder.encode(parameter);
    the following code may help:
    import java.net.*;
    public class CodificadorURL{
         public static void main(String []a){
                   System.out.println(URLEncoder.encode("="));
                   System.out.println(URLEncoder.encode("a"));
                   System.out.println(URLEncoder.encode("�"));
                   System.out.println(URLEncoder.encode("Amiga"));
                   System.out.println(URLEncoder.encode("Sesi�n"));
    }

  • Problem with UTF-8 japanese on Win XP

    Hi,
    I have a Client/server application with a server coded in C++ and runing on HP workstation and the GUI in java runing in a web context via java webstart mechanism on PC machine with win XP sp2 OS.
    when logging into the HP workstation in japanese SHIFT_JIS and downloading the application japanese Charcters are displayed correctly on my PC.
    However when logging into the HP workstation in japanese with UTF-8 encodage and kaunching the application characters aren't displayed correctly only rectangle charcaters are displayed, when launching the GUI on HP workstation it displayed correctly.
    Can any one help me to resolve this problem.
    Regards,

    Both SHIFT_JIS and UTF-8 are character encodings. SHIFT_JIS encodes a superset of JISX-0208 to double-byte codepoints and JISX-0201 to single byte codepoints. UTF-8 encodes all of Unicode.
    The problem here is that you are relying on "default" encoding for a client-server application. This only works when the default encoding is the same on both ends.
    Go through your code, looking for everywhere where you convert to and from Strings, including reading and writing to IO Streams, and replace the methods you are using with equivalent methods that let you specify an encoding.

Maybe you are looking for

  • Garageband was not able to install the new sounds

    I'm on an iMac 21.5-inch (mid 2011) running Yosemite; 2.5 GHz Intel Core i5; 4GB memory. A few months ago, I uninstalled GarageBand. Now I'm trying to reinstall it. I can get GarageBand 6 reinstalled, but I would like to get working with the latest v

  • Problems with adding music folder to itunes

    I have a music folder I want to add. The files are WMA so they should work. I checked the permissions of the files and the folders and they are fine. I changed the open with to open with itunes. I tried adding by choosing file - add to library, nothi

  • How to clear invoices posted in foreign currency in APP  VERY URGENT

    Hi Sap Gurus, I have posted 2 invoices , one is in inr (local curcy), another one in usd and i have run the app using the t.code f110 local currcy incoive was cleared but usd curcy invoice went to exception list Why this happened? how can i clear for

  • Arabic Characters

    I have an keyboard with both Arabic and English. I am facing two problems when I try to enter Arabic characters: One is that the characters are being separated i.e. not attached correctly with each other in programs like open office or microsoft offi

  • Where is cs5 design premium??? i dont have licence for cs6

    hello, i bought a new pc and i want to download ADOBE CREATIVE SUITE 5 DESIGN PREMIUM. i bought it as a student and i had activated my licence key to my old pc. i want now to install it to my new one and i cant find it at adobe.com. there is only cs6