Japanese Characters Encoding Problem

Hi All,
I have been looking at the problems posted in this forum and quite a few describe the issue I am facing currently but none has been able to provide a solution.
The problem I am facing is as follows:
Step 1: I am retrieving Japanese data from Oracle DB 9i (Oracle9i Enterprise Edition Release 9.2.0.6.0 - 64bit) using standard JDBC API calls. [NLS_CHARACTERSET : AL32UTF8,  NLS_NCHAR_CHARACTERSET : AL16UTF16]
byte[] title = resultSet.getBytes("COLUMN_NAME");
Step 2: I pass the retrieved bytes to a method that returns SJIS encoded String.
private String getStringSJIS(byte[] bytesToBeEncoded) {
          StringBuffer sb = new StringBuffer();
          try {
               if (title != null) {
                    ByteArrayInputStream bais = new ByteArrayInputStream(bytesToBeEncoded);
                    InputStreamReader isr = new InputStreamReader(bais, "SJIS");
                    for (int c = isr.read(); c != (-1); c = isr.read()) {
                         sb.append((char) c);
               return sb.toString();
          } catch (Exception ex) {;}
3) I am using an HTML Parser JAR to print the decimal value of the Encoded String.
String after = getStringSJIS(title);
System.out.println(Translate.encode(after));
I get an output of String 1: ツ禿コツ本ツ古ェツサツイツト
which contains 14 decimal character codes.
The same data is being read by another application that uses JDBC again and connects to the same DB and returns the decimal values as: String 2: 日本語サイト
The display of these two Strings differ significantly when viewed in the browser.
It seems String 1 contains single byte half-width characters and String 2 does not. Is anyone familiar as to why the bytes are getting modified while being retrieved from the Database for the same column value?

The encoding for the bytes being returned from the database is Cp1252 but this encoding, I understand, depends on the underlying platform I am using.
If indeed the data from the DB is in UTF-8 or 16, shouldn't it be displayed correctly in the browser? No encoding/decoding should be required on the data then. In the browser it gets displayed as “ú–{ŒêƒTƒCƒg. (The encoding of the JSP page is set to UTF-8.)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

Similar Messages

  • Czech characters encoding problem in RTFTemplate with Velocity engine

    Hi,
    I am trying to use your RTFTemplate project but I have trouble displaying Czech characters in the generated RTF document. Instead of characters like �čř� I get only questionmarks ????. I thought that this could be related to setting a wrong encoding in the velocity.properties file, so I set it to windows-1250 (support for Czech characters) but it didn�t help. Do you have any idea, what could be the problem? If this is not the right place to ask such question, please let me know about a better one.
    Thank you for your time,
    Ivo Jansky

    Hi Jason,
    Indeed I had contacted the provider and informed them about the encoding problem and the fact that passing the parameter http_content_charset had no effect on the sent back encoding.
    They have taken into account my request and have changed the encoding used during the request to the HOOK_URL.
    Thanks to all of your for your help.
    Regards,
    Jerome.

  • Turkish Characters Encoding Problem

    Hi,
    My java code is not going into if statement because of the Turkish characters which are fetched from database. When i printed the result value, it displays Turkish characters as question marks "?". In debug mode i can see the result variable displays correct characters.
                BindingContainer bindings = BindingContext.getCurrent().getCurrentBindingsEntry();
                OperationBinding operationBinding = bindings.getOperationBinding("getLovValue");
                operationBinding.getParamsMap().put("valueId", valueChangeEvent.getNewValue());
                String result = (String)operationBinding.execute();
                System.out.println("Result:"+result.toString());
                System.out.println("KİŞİ".equals(result));
                if(result != null) {
                    if ("KİŞİ".equals(result)) {
                        setAdiRequired(true);
                        setSoyadiRequired(true);
                        setSirketAdiRequired(false);
                    else if ("ŞİRKET".equals(result)) {
                        setAdiRequired(false);
                        setSoyadiRequired(false);
                        setSirketAdiRequired(true);
                    else {
                        setAdiRequired(false);
                        setSoyadiRequired(false);
                        setSirketAdiRequired(false);
                }Console:
    Result:K???
    false
    I really need help about this issue.
    Jdeveloper version: 11.1.2.2
    My JDeveloper Environment Encoding Setting is "UTF-8"
    Regards,
    Anil

    Hi,
    I have already told JDev version in my first post. Nevermind, I just solved problem by setting JDeveloper encoding settings to ISO-8859-9. I don't know why it is not working with UTF-8.
    Edited by: AnilA on 18.Eki.2012 11:10

  • Japanese Characters Reading Errors on WinXP - Japanese language mode ...

    I have an application that reads japanese characters encoded in Shift-JIS from a web page.
    I use the following method :
    BufferedReader dis = new BufferedReader(
         new InputStreamReader( urlConnection.getInputStream(),"SJIS"));
    On WinXP, Win98, Win2000 - english version - there are no problems, the characters are read and display CORRECTLY. Also the program work correctly.
    BUT, on WinXP - japanese version - THE SAME APPLICATION give the following ERRORS :
    Warning : Default charset MS932 not supported, using ISO-8859-1 instead.
    java.io.UnsupportedEncodingException: SJIS
    Because of this erros(I suppose) the colours of swing components are changed(I mean there are a lot of strange colors instead of the colors I set in the program - for example red is change to green, yellow to blue ...)
    Can you help me ?
    Regards,
    Cata

    I have written a java program that can write japanese+english letters data to a tab delimited .xls file.
    using SJIS as the encoding scheme. I can see japanese data in browser however the same appears
    as junk characters when I view the .xls file using Microsoft Excel 2000 Application on my WINDOWS2000 machine.
    What am I missing here ... ?
    Thanks and Regards,
    Kumar.

  • Japanese characters display with wrong encoding all of a sudden...

    I had no issues before when it came to typing in Japanese in DW using the windows language bar , I would just change the keyboard to JP(japanese) and then start typing within DW code view, but then one day after doing updating my main template and using the find and replace feature in DW all the Japanese characters turned into question marks, diamonds with question marks and ASCII alphanumeric codes..
    also the spaces in my documents  turned into blocks. It was a mess,
    *I don't know if it was something I triggered accidentaly or if it was some type of bug....I also remember copying and pasting text and Japanese characters from another website that I created(but I had done that a dozen times before and it was never a problem).
    Long story short, after not being able to find a solution I decided to manually delete the weird symbols and start over, I typed in Japanese using the windows language bar as always and began typing away inside the same pages that displayed those weird characters (sorry I don't know what the proper name for them is)and it accepted the Japanese characters with no issues, it was working just like it did before.
    but my question is "What happened?" was that a bug in DW or was it something on my end?
    I would like to know so I can fix the problem incase this happens again.
    I've always had utf-8 as the charset and it's never been an issue. (and I all my pages are saved as utf-8 as well)
    --Which is why I am confused why all the Japanese got messed up.
    Here is the head code of one of the pages that had the problem:
    Thank you.

    Without seeing an actual page, it's impossible to say what happened, but the most likely explanation is that you did something wrong. Asian characters, such as Japanese, require correct encoding. If the encoding is incorrect, you end up with mojibake.
    I suspect that what happened is that you copied and pasted from Shift-JIS or EUC-JP encoding into a different encoding. It's quite possible that your page was set to iso-8859-1 (Western European) without realizing.
    By the way, your head code didn't show up in your post.

  • Specify File Encoding(Japanese Characters) for UTL_FILE in Oracle 10g

    Hi All,
    I am creating a text file using the UTL_FILE package. The database is Oracle 10G and the charset of DB is UTF-8.
    The file is created on the DB Server machine itself which is a Windows 2003 machine with Japanese OS. Further, some tables contain Japanese characters which I need to write to the file.
    When these Japanese characters are written to the text file they occupy 3 bytes instead of 1 and distort the format of the file, I need to stick to.
    Can somebody suggest, is there a way to write the Japanese character in 1 byte or change the encoding of the file type to something else viz. ShiftJIS etc.
    Thanking in advance,
    Regards,
    Tushar

    Are you using the UTL_FILE.FOPEN_NCHAR function to open the files?
    Cheers, APC

  • Problem in displaying Japanese characters in SAPScripts

    Hi All,
    I am facing a strange problem in one of my SAPScripts. I have one script in both English and Japanese languages. The scripts are already existing. I had to do some minor changes in a logo window. I did them and i did not do any other changes in any of the windows.
    When the output wa s seen for the script in the Japanese version, it was looking ok displaying all hte Japanese characters in various windows. Now, during testing , in the same server, the Japanese characteres are not shown. Instead , some ' #'(hash) symb ols are getting displayed.
    How could it happen? Did any body face such problem? If so, can anybody plz help me out with the solution?
    What shud i do to get back the Japanese characters in my script again?
    Regards,
    Priya

    Priya.
    this is not an ABAP problem ask your BASIS team to set printer cofing from SPAD.dont worry its not an ABAP issue at all.
    sometime printer doesnt support special char so it need to be setting with printer.
    Amit.

  • Problem in displaying Japanese characters on the browser.

    Hi Friends,
    Hope one of you could help me in this!!
    We are using SHIFT_JIS character encoding in our jsps to display Japanese characters.
    <%@ page contentType="text/html; charset=SHIFT_JIS" %>
    Is there any other configuration required on server side to let the Japanese characters being displayed? Because what I am getting on screen is quite annoying. Well something like below.
    ?V?M???????�
    Even though my knowledge in Japs isn't too good :-)) I can understand that these are not Japanese. I believe I am missing something in terms of server side configuration, Can anybody point that out. (Maybe some of the Japanese developers in here).
    This could not be a client side issue, since from the same machine I can access other Japanese sites and they display properly. Let me know if anybody can help.
    I am running these in WAS 5.0
    Thanks,
    King

    Your text in the JSP should be UTF-8 nevertheless - as would be ideal
    for internationalization. Java comes with a command-line conversion tool
    native2ascii which is bidirectional.
    As non-Japanese I am not certain whether "SJIS" might not be better (there
    are some name variations in java).
    The HTML generation will translate these characters to SHIFT_JIS in your case.
    Where the target encoding cannot handle the intended character it receives a
    question mark - hat you saw.
    Furthermore you need a proper font in HTML and under Windows (window title).
    Your webserver should have east-asian support. Though Japanese (and English)
    are standard, I, as non-japanese am not certain about SHIFT_JIS.
    Also there is some freedom in choice for a japanese encoding.

  • Problem viewing Japanese characters in Excel sent via Email attachment

    Hi All
    I am using FM '''SO_DOCUMENT_SEND_API1'' to send out an e-mail attachment (Excel file). I am able to receive the Excel file successfully. However I am not able to display the Japanese characters properly in my Excel file.
    I tried to display some Japanese characters in my e-mail contents and I have no problem viewing these characters in my e-mail (I am using MS Outlook 2003). These statements becomes something illegible when I transfer it over to Excel as an attachment. In my Internal Table, these characters are displayed correctly as well.
    Anyone has any advice to solve this issue?
    Thanks for your replies.

    Hi Divya,
    refer to the link below:
    http://www.sapdevelopment.co.uk/reporting/email/attach_xls.htm
    The code in this demonstrates how to send an email to an external email addresswhere the data is stored within a .xls attachment.
    Hope this helps.
    Reward if helpful.
    Regards,
    Sipra

  • Problem with Gui_download using ASC File type - japanese characters

    Hi,
    During upgrade,while downloading data for japanese characters using GUI_DOWNLOAD Function module with file type as 'ASC', the space between 2 fields data getting much wider compared to 4.6C Version ws_download Function module's  data.
    Example: the gap between first field data and second field data in ECC 6.0 is 6 characters length,but in 4.6C it is 2 characters length.
    Is there any possibility to get the results similar to 4.6c version.Please give your valueable suggestions.
    Thanks
    BalaNarasimman

    Hi Sandra
    Please find the detailed information for your questions.
    1.Internal table content before download:During Debugging,it was observed that internal table content was same in both versions.For testing,i used only brand new data(Transaction entry).
    2.Download with code Page conversion:Yes,codepage parameter 4103 was explicitly passed into GUI_DOWNLOAD Function module.Also the front end code page which is used by system is 4110 . No errors occured.
    3.System is an Unicode system only.
    4.Actually this 6 character does not refer the byte value,only the gap between 2 fields data is getting referred in ECC 6.0.Please find the below example.
    Example - File data after Download:
    ECC 6.0: Field1            Field2      (gap - 6 characters space between 2 fields data)  Using GUI_Download
    data       u0152©Ïu201Dԍu2020      EN                               
         4.6C: Field1            Field2       (gap - 2 characters space between 2 fields data) Using WS_Download
         data    u0152©Ïu201Dԍu2020  EN    
    Note:Special characters are Japanese characters:

  • Saving a file in a with a file name containing Japanese Characters

    Hi,
    I hope some genius out there comes up with the solution to this problem
    Here it is :
    I am trying to save some files using a java program from the command console , and the file name contains japanese characters. The file names are available to me as string values from an InputStream. When I try to write to a File Object containing the japanese characters , I get something like ?????.txt . I found out that I am able to save the files using the unicode value of the java characters.
    So I realize that the trick is to convert the streaming japanese characters , character by character into their respective unicode value and then Create A File Object with that name. The problem is -> I cant find any standard method to convert these characters into their unicode values. Does anyone have a better solution ? Remember , its not writing japanese characters to a file , but creating a file with japanese characters in the file name !!!!
    Regards
    Chandu

    retrive a byte array out of the input Stream and store the values in String using the condtructor
    String(byte [] bytes, String enc)
    where encoding would be Shift_Jis for japanese I guess.
    Now to understand this concept basically all the Strings are unicode however when you are passing a byte array String has no means to know what is the encoding of the byte array, which is being used to instantiate the String value so if no encoding is specified it takes the System value which is mostly iso-8859-1. This leads to displaying ?
    However in case you know the encoding of the array specifying that in the constructor would be a real help.

  • Japanese Character Display Problem

    It seems like the new JRE does not allow Japanese characters to be displayed on anything but the title bar of an application when running on a US English XP SP2 system with all of the proper language support installed.
    I can see the Japanese Characters in the title bar, but in the rest of the application, they appear as outlined blocks. All of the text is coming from the same resource bundle so I know that it is loading correctly because it appears in the title bar correctly.
    On a Japanese system with XP SP2, everything works as expected. Is there anything that I can do to correct this? I am using JRE 1.4.2 to compile the application, and the latest JRE to display it.
    Any help would be greatly appreciated.
    -Steve

    HI out there,
    i'm having similiar problems when trying to parse / transform a database-generated xml-string containing Japanese characters into an html using a saved xsl file. I've tried zillions of ways (got from specialized forums) to do it getting hardly the same result all the time.
    Now the point is that i'm getting the known-by-all "???" characters
    but i've checked that the xml string is Genereted correctly from
    the database using in my JSP page:
    String aux = new String(TXT_FROM_DATABASE.getBytes("ISO-8859-1"), "UTF-8");...
    then the JSP sets
      request.setCharacterEncoding("UTF-8"); (not necessary i guess)
       response.setContentType( "text/html; charset=UTF-8" ); and calls a function XML2HTML (from a *.class) that makes necessary
    operations to call the transformer.transform method:
    // auxiliary function to convert the string into UTF-8 (to ensure)
    // has been tested that when calling to xml2html the String xml_string
    // is correctly formed and does contain all japanese characters (all)
    public static String convertString(String s, PrintWriter pw_out) {
           try{
             if(s == null) return s;
             String aux = "";
             byte[] bari = s.getBytes("ISO-8859-1");
             aux = new String(bari, "UTF-8");
             return aux;
           }catch (Exception e){
             pw_out.print(e.getMessage());
             return "";
      public static void XML2HTML(String xml_string, String xsl_file, ServletRequest req,
          ServletResponse res) {
          PrintWriter p_out=null ;
          String appdir = req.getRealPath("/"); 
          try{
            p_out = res.getWriter(); 
          } catch (Exception ioException){
            System.out.print(ioException.toString());
          // transformating ...
          try {
          // Creating the transformer object from the XSLT_file
          javax.xml.transform.stream.StreamSource xslFile  = new StreamSource(new File(appdir+"\\"+xsl_file+".xsl"));
          javax.xml.transform.TransformerFactory factory = TransformerFactory.newInstance();
          javax.xml.transform.Transformer transformer = factory.newTransformer(xslFile);
          transformer.setOutputProperty(javax.xml.transform.OutputKeys.ENCODING,"UTF-8");
          transformer.setOutputProperty(javax.xml.transform.OutputKeys.INDENT,"yes");
          transformer.setOutputProperty(javax.xml.transform.OutputKeys.METHOD,"html");
         // create the source Stream
          String xmldata = convertString(xml_string,p_out);
          StringReader xml_sr = new StringReader(xmldata);
          StreamSource xml_source = new StreamSource(xml_sr);
          // result Stream
          javax.xml.transform.stream.StreamResult outResult = new javax.xml.transform.stream.StreamResult(p_out);
           //calling the transform method !! (source/result)
          transformer.transform(xml_source,outResul
          } catch (Exception e){
            p_out.print ("<br/>EXCEPTION__" + e.toString());
            p_out.print ("<br/>CAUSE" + e.getCause());
            p_out.print ("<br/>nMSG" + ((TransformerException)e).getMessageAndLocation());
    } and my XSL DOES contain these lines at the very beginning:
    <?xml version="1.0" encoding="UTF-8"?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output method="html" encoding="UTF-8" media-type="text/html; charset=UTF-8"/>more:
    * all my files are saved as UTF-8
    what makes me go crazy:
    * In the jsp after the call to the xml2html method i've written
    <%=xml_string%> and it does write "????" characters for all elements
    except for one of them (japanese word that i wrote out directly in japanese,
    but if in the jsp page i INCLUDE
      <%@page language="java" pageEncoding="utf8" contentType="text/html; charset=UTF8"%>
    THEN THIS only written-out element in japanese is not displayed correctly either.
    and even MORE !
    if in the xsl file i include:
      <head>
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
      </head> it does not display it correctly neither...
    is this possible ?
    may the problem be that the function i'm calling is in a *.class ?
    please help (i've been working around for days now)
    my work enviroment is
    eclipse (project set to utf-8 encoding)
    wsas 5.0
    jdk 1.4
    thank you for your time
    and nice day to you all!!
    gREEtings from malaga (spain)

  • Acrobat Pro 9.3.1 does not convert certain Japanese characters

    I have a text document that contains a mix of Roman and Japanese characters - when I do Create PDF From File and read that text document in, there is a sequence of 2 Japanese characters that disappear - the text before them and after them appear in the PDF, but there's a void between.
    The sequence is (don't know if I can insert Japanese in here...)
    before監査証跡after
    When the PDF is generated, the first 2 Japanese characters (after the last 'e' in before) do not appear in the PDF.
    Here is the source text document (UTF-8 encoded with BOM): http://www.scribd.com/doc/28158046
    and here is the resulting PDF: http://www.scribd.com/doc/28158121
    Anyone seen this before?

    If I paste your "before監査証跡after" into Notepad and save it as UTF-8 text, I can print the file to the Acrobat 9.3.1 Pro "Adobe PDF" printer with no problems at all: the 4 kanji appear in a font Acrobat calls "MS-UIGothic".  If I right-click on the saved *.txt file in Windows Exploreer (Vista 64) and select "Convert to Adobe PDF" I still get all the kanji, although the first shows up in Adobe Ming, the 2nd in Adobe Song, and the last 2 in KozGoPr6N.
    I can't explain what's going on here, but perhaps this can help point you down a useful path.
    David

  • Copying Japanese Characters to the clipboard - Error/glitch

    Hi all,
    I am learning Japanese. I have Japanese input activated and can easily switch between English and Japanese, and Japanese displays correctly for me. One thing that is driving me crazy is that sometimes the Japanese characters won't copy/paste correctly. I can type them fine, but copying them from one spot and trying to paste them into another spot brings up nothing but garbage. It doesn't seem to matter which program I'm copying from or pasting to. And it seems to turn on and off randomly. It won't work for a long time, and then all of a sudden, it will work for a short while. Then it stops again!
    Does anyone have any clue as to what is causing this? Or how to fix it? This problem makes it extremely hard to explore Japanese text using a dictionary, as I can no longer look words up properly.
    Thanks for your help.
    Josta
    Short demonstration:
    日本語 <-- typed out
    eÂg,äû <-- copied and pasted back in
    Message was edited by: Josta7
    Message was edited by: Josta7

    It doesn't seem to matter which program I'm copying from or pasting to.
    Can you give an example of common programs where this happens? Does it ever occur when you are copy/pasting from or to TextEdit?
    Short demonstration:
    日本語 <-- typed out
    eÂg,äû <-- copied and pasted back in</div>
    Looks like an encoding glitch of some sort.

  • Url char-encoding problem

    I am connecting to a web-server. The URL has Japanese characters embedded in it.
    When run from NetBeans 6.8 everything works ok.
    When run from the shell, the server appears to not understand the Japanese characters. For example, if the Japanese characters represent a user name, none of the names are ever understood.
    Default charset when run from IDE is "UTF-8".
    Default when run from shell: "Cp1252".
    I don't want a systemic solution [for example a command-line switch, or config file setting]. I want to control every IO stream's encoding manually.
    This is the test that comes closest to what I think should work:
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    OutputStreamWriter baosStreamWrt = new OutputStreamWriter(baos, utf8.newEncoder());
    BufferedWriter bufWrt = new BufferedWriter(baosStreamWrt);
    bufWrt.write(url_with_jp_characters);
    bufWrt.flush();
    ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
    InputStreamReader inStreamRdr = new InputStreamReader(bais, utf8.newDecoder());
    BufferedReader bufRdr = new BufferedReader(inStreamRdr);
    String faulty_url = bufRdr.readLine();
    URL webpage = new URL(faulty_url);
    URLConnection urlConn = webpage.openConnection();
    BufferedReader webIn = new BufferedReader(new InputStreamReader(urlConn.getInputStream(), utf8.newDecoder()));
    BufferedWriter response = new BufferedWriter(new OutputStreamWriter(new FileOutputStream("/tmp/dump.txt"), utf8.newEncoder()));
    response.("checking the the url: ")
    response.write(faulty_url);
    response.newLine();
    while(true) {
      String webLine = webIn.readLine();
      if(webLine == null) { break; }
      response.write(webLine);
      response.newLine();
    response.close();
    webIn.close();
    ....Inspecting the response from the server in the file "/tmp/dump.txt":
    (1) the file is formatted "UTF-8".
    (2) the url, written in the first line of the file, is valid and a cut/paste into a browser works correctly.
    (3) many correctly formed Japanese words are in the response from the server that is saying: "I have no idea how to understand/(decode?) the user name you sent me in the URL."
    At this point I have a choice:
    (1) I don't understand the source of the problem?
    (2) I need to keep banging away at trying to get the url correctly encoded.
    Finally, how can I debug this???
    (1) It works in the IDE, so I don't have those debugging tools.
    (2) My terminal cannot display asian characters.
    (3) Writing output to files involves another encoder for the FileWriter which taints everything in the file.
    (4) I don't have a webserver to act as a surrogate for the real one.
    thanks.

    Kayaman wrote:
    rerf wrote:
    And I don't know why NetBeans allowed me to get around not using this command.Because of the default charset of UTF-8 that's set in Netbeans.I see that, but something more subtle was happeneing I think. I still don't fully understand. Here is my best explanation. Exact code:
    ....for(File f : files) {
      BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream(f), utf8.newDecoder()));
      String jpName = in.readLine().split(";")[0];
      String jpNameForUrlUsage = URLEncoder.encode(jpName, "UTF-8");
      String dumpFileName = (outputDir + f.getName().split(".txt")[0] + "-dump.txt");
      BufferedWriter out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(dumpFileName), utf8.newEncoder()));
      URL url = new URL("http://www.abc.cp.jp?name=" + jpNameForUrlUsage);
      URLConnection urlConn = url.openConnection();
    }....In my first post, I formed the complete url, then encoded it to utf-8 using ByteArray[Input / Output]Streams. But, my understanding is that you can't just encode Japanese characters to utf-8 and then append them to a url. A special method call is needed to transform the Japanese characters into something understandable by the URL (and its not as simple as just encoding the characters to utf-8). After posting, I actually made an effort to read all of javadoc for java.net.URL:
    java.net.URL
    The URL class does not itself encode or decode any URL components according to the escaping mechanism defined in RFC2396. It is the responsibility of the caller to encode any fields, which need to be escaped prior to calling URL, and also to decode any escaped fields, that are returned from URL. Furthermore, because URL has no knowledge of URL escaping, it does not recognise equivalence between the encoded or decoded form of the same URL. For example, the two URLs:
    http://foo.com/hello world/ and http://foo.com/hello%20world
    would be considered not equal to each other.
    Note, the URI class does perform escaping of its component fields in certain circumstances. The recommended way to manage the encoding and decoding of URLs is to use URI, and to convert between these two classes using toURI() and URI.toURL().....
    Then, it all made sense. I had already diagnosed that it was just the Japanese character part of the URL that caused the failure. And I remember reading that the Chinese were upset that they could not use asian characters in URLs. So, even though in my browser it looks like a Japanese character is in it, its really not. Chrome browser is doing some transform from what I see in my browser URL and what the actual URL is. That is why cutting/pasting the url I was forming in Java into the browser is not a good representation of what is going on. Chrome, behind the scenes does what the URLEncoder class does.
    Yet, I could very easily be wrong:
    On the one hand NetBeans worked, and the shell did not. The relevant difference being default charset.
    But on the other hand, in my initial post, I completely encoded that url into utf-8 using ByteArray[Input / Output]Streams. I am no expert on character encodings, but if the url I created in the initial posting is not utf-8 encoded then I need a few pointers on how to character encode.
    final thought:
    I can't just encode a Japanese character to UTF-8, append it to a URL, and expect it to work. A browser can make it look that way so its deceiving. That is why there is the class URLEncoder. I don't understand why NetBeans appears to invoke it for me without my knowledge. And maybe its not. Having the default charset as utf-8 might obviate the need for a URLEncoder() call (but I don't see why it should).

Maybe you are looking for