Netbeans Issue: Servlet do not display Chinese UTF-8 properly

Netbeans Issue: Servlet do not display Chinese UTF-8 properly
Java Version: JDK1.5.0_01, JRE1.5.0_01 (International version)
Netbeans Version: Netbeans IDE 4.0
OS: Windows XP Personal Edition
Dear Sirs,
First at all thanks for reading this post. I am having the following issue. I am creating an application using html pages and servlets. I am using Chinese and English languages on them (html encoding UTF-8).
I created a project in Netbeans and added an idex.html screen reporting to a servlet. Both index.html and in the servlet generated html page contains the line:
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
Additional, I setup the character code settings in Netbeans:
(tools-options-Java sources-Expert-default encoding=UTF-8
When I run the project, index.html displays itself perfectly, with the Chinese characters displayed properly. The problem comes when the html created servlet is displayed, which instead of the Chinese characters some strange characters are displayed (�� instead of Chinese).
I have tried different encodings from http://java.sun.com/j2se/1.4.2/docs/guide/intl/encoding.doc.html without any luck. I also setup the encoding of the file itself (using right click-properties in the project menu of Netbeans).
Also, when I am editing the servlet, the characters are displayed properly. I type them directly without any issue, but then the display is wrong at runtime.
Also, just in case this have something to do with the problem, my PC was bought in US, therefore the default character set is not Chinese. I had to install the Chinese typing stuff later on. But like I said earlier, the html page is displayed properly, so I really think is some problem with Netbeans.
After a week trying to find a solution, I decided to post it here in the hopes that someone will show me the way of the light.
Thanks in advance for any ideas or help provided
Aral.

Hi, thanks for your help. However I think the problem his more complex than it seems. Here is my doPost method (the important parts anyway):
response.setCharacterEncoding("UTF-8"); //Not necessary because the next line should take care of it, but anyways...
response.setContentType("text/html; charset=UTF-8; pageEncoding=UTF-8");
PrintWriter out = response.getWriter();
out.println("<html>");
out.println("<head>");
out.println("<meta http-equiv='Content-Language' content='en-us'>");
out.println("<meta http-equiv='Content-Type' content='text/html; charset=utf-8; pageEncoding=utf-8'>"); //Again not necessary line, but anyways
out.println("<title>Servlet</title>");
out.println("</head>");
out.println("<body>");
out.println("this is a test &#20320;&#22909; this is a test");
out.println("</body>");
out.println("</html>");
out.close();
This servlet is called from a html file. Also, when I load this in the browser, I right click on the screen and I can see that UTF-8 is setup allright. Doing some detective job I found that:
- If the editor displays the characters perfectly and...
- Other html pages (no servlets) in the same application can display chinese characters well and...
- I have configured the encoding as UTF-8 in the servlet properties and in general properties and...
- The file "web.xml" contains the encoding UTF-8 in its first line then...
...my only guess is that something goes wrong during the building of the project itself (ant?). Unfortunately I have no idea about configuring ant to that level, but I began to think that the problem may be there, during the compilation...
Any ideas?
Once more, thanks for any help or advice provided.
Aral.

Similar Messages

  • Can not display Chinese on discoverer plus

    i have moved this thread to this forum from discoverer.
    Dear,
    ebs 12.0.6
    OS OUL5x64
    AS 10.1.2.3
    using bi 10.1.2.3 with discoverer
    Discoverer Version:Server 10.1.2.55.26
    when connect to the viewer like
    http:10.10.10.10:7778/viewer
    it could display the Chinese character correctly
    when connect
    http:10.10.10.10:7778/plus
    the Chinese became square boxes.
    Please advise how to fix this error.
    Regards,
    Tom

    Hi Huusein,
    i found these file in application tier, they were all upper case.
    ALBANWTJ.ttf
    -rw-rw-r-- 1 oracle oinstall 18777080 Dec 29 2006 ALBANWTK.ttf
    -rw-rw-r-- 1 oracle oinstall 18676032 Dec 29 2006 ALBANWTS.ttf
    -rw-rw-r-- 1 oracle oinstall 18788548 Dec 29 2006 ALBANWTT.ttf
    copied them over and restart the opmnctl stopall and then startall but the discoverer/plus could not display Chinese, i then renamed it to lower case according with doc # Doc ID:      340944.1
    and restart the opmnctl again but it still could not display Chinese in discoverer/plus
    these files (5) from the doc 340944.1 but my actual from appl Tier only has 4 files with all upper case.
    AlbanWTJ.ttf
    AlbanWTK.ttf
    AlbanWTS.ttf
    AlbanWTT.ttf
    ALBANYWT.ttf
    can you please give me some suggestions.
    Regards,
    Tom

  • Safari not displaying some web pages properly why?

    I have been finding of late that safari does not display certain web pages properly. i.e.: text overlaps other text  and is not formatted properly. This seems to have become more common lately. Even Apple's own apple info page does not display properly. Could this be a setting in safari that I have messed up somehow?

    Go step by step and test.
    1. Delete Cookies
        Safari > Preferences > Privacy > Cookies and other website data:
        Click the “Details” button.
        Remove all cookies except from Apple, your internet service provider and banks.
    2. Safari > Preferences > Extensions
        Turn off Extensions if any and launch Safari again to test.
        Turn on those one by one and test.
    3. Delete Caches.db
        Close all windows and quit all applications.
        Hold "option" key down and click "Go" menu in the Finder menu bar.
        Select "Library" from the dropdown.
        Library > Caches > com.apple.Safari > Caches.db
        Right click the Caches.db file and select "Move To Trash.
        Close windows and relaunch Safari.
    4. Empty Caches
        Safari > Preference > Advanced
        Checkmark the box for "Show Develop menu in menu bar".
        Develop menu will appear in the Safari menu bar.
        Click Develop and select "Empty Caches" from the dropdown.
    5. Temporarily  turn off  Safari iCloud sync and test.
         System Preferences > iCloud
         Uncheck the box beside “Safari” and test.

  • Servlet output not displayed properly in Internet Explorer

    Hi All,
    I'm developing a servlet which uploads a file. After the servlet parses the request body, it stores the file contents as a binary string in the database. While displaying the contents of the attached file, the IE(Internet Explorer) is ignoring all the newlines and spaces. IThe same uploaded file when viewed through Firefox browser is being displayed properly. I've added some debug statements to print the filecontent before sending it to servlet output stream. They look exactly as they were in the uploaded file. The MIME type is application/octet-stream.
    I've also made the response to accept "ISO-8859-1" and "UTF-8" charsets, yet the IE is not rendering the file contents properly. The code looks like this,
    response.setContentType("text/html; charset= ISO-8859-1, UTF-8");
    byte[] buff = attachment.getAttachObject();
    OutputStream out = response.getOutputStream();
    out.write(buff);
    out.close();
    I've tried using PrintWriter also. I've tried changing the content types, character encodings of request and response objects, still couldn't resolve the issue. What really baffles me is that when it's displaying properly in Firefox, why can't it render properly in IE? I'm using Win XP SP2, and IE version is 6.0.29. The content which is being sent to the output stream contains newline and space characters, but they are not displayed in the browser. Did any one face this sort of issue? Your help is highly appreciated.
    Thanks,
    Tarun.

    Hi,
    Thanks for looking into the issue. Let me tell you that I've tried keeping various content-types like text/plain, text/xml etc, but in none of those cases the IE rendered the output properly. But with the same content-type i.e text/html or text/plain, Firefox is able to render the file content properly. I've tried a brutal force approach like below,
    response.setContentType("text/plain");
    PrintWriter out = response.getWriter();
    String str = new String(attachment.getAttachObject());
    char[] buff = str.toCharArray();
    for(i=0;i< buff.length; i++)
    int n = (int)buff;
    if(n == 10)
    out.println();
    else
    out.print(buff[i]);
    out.close();
    I was trying to print a newline whenever I find a newline character in the file content. Even this didn't work. Please suggest me some way to get rid of this problem.

  • Chinese Data Fields not displaying Chinese Characters

    Hi There,
    Wonder if someone can help. We are currently running reports in Crystal 8.5 but are in the process of upgrading our business systems to latest version and this includes converting all our Crystal 8.5 reports to Crystal Reports XI R2 SP4.
    During the process we are experiencing some difficulties in displaying Chinese characters, which have previously worked fine in version 8.5. The system we are running Crystal from has Oracle client 11 installed and the OS system locale is set to Chinese PRC. Our application is displaying Chinese characters properly and if we have any text fields on the report, these are also displaying properly when changing Font to Arial Unicode MS. The only thing that doesn't display properly is the field data which after checking has the correct Chinese data stored in the database. For some reason Crystal 11.5 doesn't seem to be transferring the data correctly which points to some sort of encoding problem.
    Is there something I am missing here or is there something else I need to install for this to work?
    Any hep would be appreciated.

    What is your Oracle database's language set? Is it set to UTF-8 or non UTF-8 (such as American_America.WE8ISO8859P1" )?
    There is a similar issue tracked under ID ADAPT00528561 (Crystal cannot display non-UTF-8 Chinese characters from an Oracle database ) and has been fixed and you should set the following registry key to make it effective:
    Set the following registry key "UseOSLocaleForConversion" to "Yes" under:
    HKEY_LOCAL_MACHINE\Software\Business Objects\Suite 11.5\Crystal Reports\Database\Oracle

  • Samsung Continuum Issues - Picture messages NOT displaying embedded images + Android 2.2?

    I recently purchased the samsung continuum a few months ago and have had a difficult time with the following two issues:
    The phone is NOT rooted.
    (1) Picture Messages are not displaying as embedded images in my message notifications. All i see is "Message Size and the word downloading.  The picture is only 10K, so it should download relatively fast.  The image does not appear in my gallery either.  Please help?  Where is the image and why can't i see it in my message.According to the notes in SCH-I400.DL17, this issue should have been resolved.     
    (2) How come the Contiuum has not received an update to Android 2.2?  The Fascinate and Continuum were both released at the same time and the Fascinate received the update.
    Here is my phone specs:
    Phone information:    
    Hardware version:  i400.0.6 
    Firmware version:  2.1-update1 
    Baseband version:  S:i400.0.6V.DL17 
    Kernel version 2.6.29 
    Build number:  SCH-I400.DL17    

    I don't understand how the Fascinate has Android 2.2, but is discontinued and the Continuum is still being sold new. What is up with that Verizon? I like the Continuum but would like to see it upgraded.  I still have over a year till I can get a new phone too. Very confusing.
    Sorry I can't help you with the picture messages as I don't have a solution.

  • ADF components do not display Chinese simplified (showing English instead)

    Dear All
    I am having a problem getting ADF components to display in Chinese simplified language. Buttons display in Chinese correctly however components such as: < af:table > (the previous and next values do not display in Chinese, again in English only).
    I have tried it under Japanese and these components show Japanese.
    Any ideas on what the problem may be caused by would be greatly appreciated.
    Best regards
    Andrew Och

    Actually I found the problem.
    It seems that the language resource bundle has the incorrect name. Renaming:
    oracle.adfinternal.view.faces.ui.laf.oracle.desktop.resource.BLAFBundle_zh_CN.java
    to
    oracle.adfinternal.view.faces.ui.laf.oracle.desktop.resource.BLAFBundle_zh.java
    resolved my problem.

  • Goods issue document is not displaying in production order

    Hi Gurus, I am having problem That when I am doing goods issue in MB1A t code the document is posting but it is not displaying in production order.but when I am doing same goods issue in MIGO the document is displaying in Production order.when I am doing same goods issue in another plant with MB1A the document is showing.so where is the problem??is there any setting with plant and T code combination??what exactly is the error??why it is not showing in particular t code in particular plant.Please guide me.
    Thanks in Advance.

    Hi,
    Check in transaction OPL8 for the combination of plant and order type..is the below indicator are activated or not...
    Thanks
    Kumar

  • Markup not displaying Doc/docx/PDF properly

    Hey everyone,
    I'm using Oracle text in conjunction with Apex, all on top of the 11G database. My issue is that using the Oracle text Markup, many files types do not display properly. The level of wrongness varies, from some readable text to complete gibberish. This happens to all version of PDFs, Docs, and Docx files. A sample of what appears is below:
    Æ
    @à°€P ðÀ!dðgd£n=gd8h²„h^„hgd8h²^
    &F
    Æ
    p@à°€P ðÀ!dðEÆ€^ZfFG·ðgd÷i+
    &F„˜þ`„˜þgd÷i+
    &F
    Æ
    pà°€P ðÀ!dðgdýOôHN”³´ÔÕûý     "#f‘ðáÕáÁ²Õ² Ž|n]L²8-h£n=h£n=CJaJ&h£n=h÷i+6B*CJ\]aJph h8h²h÷i+5B*CJaJph h£n=h÷i+5B*CJaJphh£n=5B*CJaJph#h£n=h£n=5>*B*CJaJph#h£n=h÷i+5>*B*CJaJph#h8h²h÷i+5>*B*CJaJphh8h²h÷i+B*CJaJph&h8h²h÷i+6B*CJ\]aJphh£n=B*CJaJphh£n=h÷i+B*CJaJphh£n=h£n=B*CJaJph´üý#â„_B
    &F
    However, using a simple .txt file, the result is nearly perfect and everything is complete readable.
    create or replace PROCEDURE test
         (p_id      IN VARCHAR2,
           p_query   IN VARCHAR2)
        AS
          v_clob         CLOB;
          v_read_amount INTEGER := 32767;
          v_read_offset INTEGER := 1;
          v_buffer      VARCHAR2 (32767);
        BEGIN
            htp.p('<b>HTML version with highlighted terms</b>');
         CTX_DOC.MARKUP
           (index_name => 'DOCUMENTS_INDEX',
             textkey    => p_id,
             text_query => p_query,
             restab     => v_clob,
             starttag   => '<i><font color=red>',
             endtag     => '</font></i>');
         LOOP
            BEGIN
                dbms_lob.read(v_clob,v_read_amount,v_read_offset,v_buffer);
                htp.p(v_buffer);
                v_read_offset := v_read_offset + v_read_amount;
                v_read_amount := 32767;
            EXCEPTION
              WHEN NO_DATA_FOUND THEN EXIT;
            END;
         END LOOP;
       END test;The above is the procedure I'm using if that helps. If anyone has ideas about what's going wrong, I'd greatly appreciate it.

    Well, I figured this one out on my own. I had been using a multi-column datastore, and it turns out that you have to turn on auto-filtering for each column you add. Once I had done this and rebuilt my index, my markup was much more accurate and readable. Hopefully this can help out anyone else going through this issue.

  • Firefox not displaying web page icons properly unless in safe-mode

    Hi. We are developing a website at the moment and unless I have FF in safe-mode some of the icons do not display properly. All other browsers work fine and it used to display in FF with no issues. The website is www.livingonmars.com and the icons are the 2 arrows in the top right hand corner of the slideshow. When in safe-mode I see both of the arrows. When started in normal mode I see the bottom half of the left arrow and the top half of the right arrow.

    In safe mode, hardware acceleration and add-ons are disabled. You may want to try to disable you add-ons one by one to see if that helps or you can disable hardware acceleration by performing the below:
    Try disabling graphics hardware acceleration. Since this feature was added to Firefox, it has gradually improved, but there still are a few glitches.
    You might need to restart Firefox in order for this to take effect, so save all work first (e.g., mail you are composing, online documents you're editing, etc.).
    Then perform these steps:
    *Click the orange Firefox button at the top left, then select the "Options" button, or, if there is no Firefox button at the top, go to Tools > Options.
    *In the Firefox options window click the ''Advanced'' tab, then select "General".
    *In the settings list, you should find the ''Use hardware acceleration when available'' checkbox. Uncheck this checkbox.
    *Now, restart Firefox and see if the problems persist.
    Additionally, please check for updates for your graphics driver by following the steps mentioned in the following Knowledge base articles:
    * [[Troubleshoot extensions, themes and hardware acceleration issues to solve common Firefox problems]]
    * [[Upgrade your graphics drivers to use hardware acceleration and WebGL]]

  • FireFox is not displaying our VPN page properly.

    ''locking this thread as duplicate, please continue at [https://support.mozilla.org/en-US/questions/979608 /questions/979608]''
    Dear, fire fox is not displaying our company VPN page properly. Please help me in this regards. However internet explorer properly displays that page. I can send you more details if required by you.
    Regards,
    Salman Khalid.
    HBL, Pakistan.

    Is there content missing or does it only show differently?
    You can try these steps in case of issues with web pages:
    Reload web page(s) and bypass the cache to refresh possibly outdated or corrupted files.
    *Hold down the Shift key and left-click the Reload button
    *Press "Ctrl + F5" or press "Ctrl + Shift + R" (Windows,Linux)
    *Press "Command + Shift + R" (Mac)
    Clear the cache and cookies only from websites that cause problems.
    "Clear the Cache":
    *Firefox/Tools > Options > Advanced > Network > Cached Web Content: "Clear Now"
    "Remove Cookies" from sites causing problems:
    *Firefox/Tools > Options > Privacy > Cookies: "Show Cookies"
    Start Firefox in <u>[[Safe Mode|Safe Mode]]</u> to check if one of the extensions (Firefox/Tools > Add-ons > Extensions) or if hardware acceleration is causing the problem (switch to the DEFAULT theme: Firefox/Tools > Add-ons > Appearance).
    *Do NOT click the Reset button on the Safe Mode start window.
    *https://support.mozilla.org/kb/Safe+Mode
    *https://support.mozilla.org/kb/Troubleshooting+extensions+and+themes

  • Firefox not displaying fonts and sizes properly

    In firefox the fonts are not displaying properly they are either bold or small and bold some text is displayed normally but most is not most is either really small or bold. This is also the case for IE, im on windows 7 running latest versions. However Chrome, Opera and Safari all display correct fonts and sizes it is just firefox and IE that are affected. And yes everything from font size to page size is at default so please dont reply with zoom in and out thanks.

    Hey thanks for the reply. Not sure which one of these worked nothing changed until I restarted firefox.
    You can try different default fonts.
    Tools > Options > Content : Fonts & Colors > Advanced
    [ ] "Allow pages to choose their own fonts, instead of my selections above"
    You can also try to disable hardware acceleration.
    Tools > Options > Advanced > General > Browsing: "Use hardware acceleration when available"
    But it is back to how it was thank you very much!

  • Firefox will not display my photo website properly nor play the music from it on my new computer. I have 2 other PCs and it works fine on those.

    Just set up a new PC and downloaded Firefox. It will not display my Zenfolio Photo website correctly nor will it play the music that accompanies the main page slideshow. I have 2 other PCs and it works fine on them. All are Windows 7 Home Premium.

    Note that there is nothing wrong with setting Flash to "Ask to Activate" and click the Lego block icon on the Navigation Toolbar to activate the Flash plugin when needed.
    You can verify on the Adobe Flash Players Test Page that the Flash plugin is working and which version you have once you have installed the plugin and checked the setting in "Firefox/Tools > Add-ons > Plugins"
    * http://www.adobe.com/software/flash/about/

  • JavaDoc issue:  @see tags not displaying properly

    I am having a very odd issue that I cannot seem to figure out. I am trying to add the following lines to a comment on a specific method:
    @see javax.mail.internet.MimeMessage#setSubject(java.lang.String)
    @see java.util.Properties#getProperty(java.lang.String)
    My problem is, when the html is generated...it shows
    See also:
    MimeMessage, Properties.getProperty(java.lang.String)
    I have both the J2SE and J2EE documentation linked so that these are linked to the source api on sun's site. When I click on MimeMessage it does send me to the setSubject() method within the MimeMessage class. So why does it not show MimeMessage.setSubject(java.lang.String)? Instead it just shows the class name. And why does Properties.getProperty(java.lang.String) properly show on the documentation but the MimeMessage class does not show the specific method it is linking to?

    Here is my set of @see tags for this method:
    @see javax.mail.Session#getInstance(java.util.Properties, javax.mail.Authenticator)
    @see javax.mail.internet.MimeMessage#setRecipients(javax.mail.Message.RecipientType, javax.mail.Address[])
    @see javax.mail.internet.MimeMessage#setSentDate(java.util.Date)
    @see javax.mail.internet.MimeMessage#setSubject(java.lang.String)
    @see javax.mail.internet.MimeMessage#setHeader(java.lang.String, java.lang.String)
    @see java.util.Properties#getProperty(java.lang.String)
    @see java.util.Properties#list(java.io.PrintStream)
    @see javax.mail.internet.MimeMessage#setFrom(javax.mail.Address)
    @see java.io.StringWriter#write(java.lang.String)
    @see javax.mail.internet.MimeBodyPart#setContent(java.lang.Object, java.lang.String)
    @see javax.mail.Multipart#addBodyPart(javax.mail.BodyPart)
    @see javax.mail.Transport#send(javax.mail.Message)And here is what it outputs on the documentation:
    See Also:
    Session, MimeMessage, MimeMessage, MimeMessage, MimeMessage, Properties.getProperty(java.lang.String), Properties.list(java.io.PrintStream), MimeMessage, StringWriter.write(java.lang.String), MimeBodyPart, Multipart, Transport
    I am using an ant build to generate the documentation, here is the javadoc target:
    <target name="javadoc" description="Generates javadoc">
         <!--     Backup current javadocs directory and create new directory     -->
         <script language='javascript' src='./WebContent/js/javadocs/javadocBackup.js'></script>
         <delete dir="${backupdoc.dir}" failonerror="false"/>
         <move file="${doc.dir}" tofile="${backupdoc.dir}"/>
         <delete dir="${doc.dir}" failonerror="false"/>
         <mkdir dir="${doc.dir}" />
         <javadoc destdir="${doc.dir}" access="package" use="true" notree="false" nonavbar="false"
              noindex="false" splitindex="true" author="true" version="true" nodeprecatedlist="false"
              packagenames="us.or.state.dhs.*" sourcepath="${src.dir}" doctitle="${project.name}"
              windowtitle="${project.name} - API reference." stylesheetfile="../documents/javadocs.css"
              bottom="<script src='../../WebContent/js/javadocs/javadocTopBanner.js'></script>">
              <!--     Link to external API documentation     -->
              <link href="http://java.sun.com/j2ee/1.4/docs/api/"/>
              <link href="http://java.sun.com/j2se/1.4.2/docs/api"/>
         </javadoc>
    </target>It is just really odd that the classes within the j2se docs are displaying correctly whereas the j2ee classes are not. The j2see classes link correctly and point to the correct methods when you click on them. They just aren't displaying correctly as you see above with the 4 MimeMessage classes and the Session, Transport, etc.
    Any help is appreciated, thanks for responding! :)

  • Issues with Dates not displaying

    Hello! I've built a small form with HTMLDB to handle operational tickets/issues/incidents. I've been able to display the data in one page, graph statistics in another but my page where the incidents can be edited has a small issue.
    When I click on an edit icon (on pg1) to edit the row, it brings me to page 2 and all the data from that row is displayed EXCEPT for the dates. I've chosen a date picker for that item but in the case where that column was already filled with a date beforehand, it now displays null. All the other data (numbers and varchar2s) display without issue. I can edit the fields and submit the changes and all the changes update correctly (even the dates once new ones are picked) but in some cases I do not want to change that date but display it for informational purposes.
    I'm using the TIMESTAMP datatype for those dates by the way.
    Thanks,
    Thom

    Indeed! I used the wizard and had the dates as TIMESTAMP datatypes. I changed the datatypes back to DATE for now and it works perfectly. Another satisfied customer! ;-)
    Thanks!

Maybe you are looking for

  • Hidden parameters issue.

    Hi Our reporting developers/management started to complain about their reports running slow after upgrade to 11.1.0.7. Not only is the upgrade teh only change, but they are moving their reports from a single standalone instance to a rac instance. Thi

  • Customer Name on Sales Order not in Data Collections

    Hi, I am looking for some help. My company just did an upgrade from 11i to R12 in the middle of May. As part of the upgrade we installed ASCP. We have noticed that certain customers are not being collected when running Standard Data Collections. We h

  • Help Fix erorr Contentpresenter

    Hi All I using weblogic portal 10.3, i use porlet Content Presenter have get content in CMS, but many times throws erorr such as: ####<Aug 9, 2012 9:12:52 AM ICT> <Error> <netuix> <portalXXXXXXXXXX> <MS0XXXXXXXXXXX> <[ACTIVE] ExecuteThread: '113' for

  • Pricing not copied from qoutation to Sales Order.

    Hi All, Issue: Discount pricing is not copied from Qoutation to Sales order. Please suggest the correct copy control/Routine programs which i can check to proceed furthur. Points will be rewarded. Regards, neslin.

  • Data Binding for Tree Component

    Hi , I have to make a tree structure and bind it to a column in a table, which when expanded should list the rows of the table for the selected column as individual sub nodes of the tree. So far I am not able to get that done. Any suggestions how to