Create HTML file that can display unicode (japanese) characters

Hi,
Product:           Java Web Application
Operating system:     Windows NT/2000 server, Linux, FreeBSD
Web Server:          IIS, Apache etc
Application server:     Tomcat 3.2.4, JRun, WebLogic etc
Database server:     MySQL 3.23.49, MS-SQL, Oracle etc
Java Architecture:     JSP (presentation) + Java Bean (Business logic)
Language:          English, Japanese, chinese, italian, arabic etc
Through our java application we need to create HTML files that have to display unicode text. Our present works well with English and most of the european character set. But when we tried to create HTML files that will display unidoce text, say japanese, only ???? is getting displayed. Following is the code we have used. The out on the browser displays the japanese characters correctly. But the created file displays only ??? in place of japanese chars. Can anybody tell how can we do it?
<%
String s = request.getParameter( "txt1" );
out.println("Orignial Text " + s);
//for html output
String f_str_content="";
f_str_content = f_str_content +"<HTML><HEAD>";
f_str_content = f_str_content +"<META content=\"text/html; charset=utf-8\" http-equiv=Content-Type></HEAD>";
f_str_content = f_str_content +"<BODY> ";
f_str_content = f_str_content +s;
f_str_content = f_str_content +"</BODY></HTML>";
f_str_content = new String(f_str_content.getBytes("8859_9"),"Shift_JIS");
out.println("file = " + f_str_content);
          byte f_arr_c_buffer1[] = new byte[f_str_content.length()];
f_str_content.getBytes(0,f_str_content.length(),f_arr_c_buffer1,0);
          f_arr_c_buffer1 = f_str_content.getBytes();
FileOutputStream l_obj_fout; //file object
//file object for html file
File l_obj_f5 = new File("jap127.html");
if(l_obj_f5.exists()) //for dir check
l_obj_f5.delete();
l_obj_f5.createNewFile();
l_obj_fout = new FileOutputStream(l_obj_f5); //file output stream for writing
for(int i = 0;i<f_arr_c_buffer1.length;i++ ) //for writing
l_obj_fout.write(f_arr_c_buffer1);
l_obj_fout.close();
%>
thanx.

Try changing the charset attribute within the META tag from 'utf-8' to 'SHIFT_JIS' or 'utf-16'. One of those two ought to do the trick for you.
Hope that helps,
Martin Hughes

Similar Messages

  • How to create PDF files that can't by copied by MAC

    Hi,
    I need to create pdf files that I can put on my website, that cannot be copied or edited by MAC users. I have created pdfs that can't be copied by Windows users, but they're still copyable by Mac users.
    Thank  you!
    Alicia

    Your Windows users must be exceptionally uninformed...

  • I want to display a HTML file that is stored locally on my machine.

    Hello,
    I am having a problem with my paths (I believe). I have created a JEditorPane that reads in a HTLM page. If the page is form the web it works fine:
    page_jep.setPage("http://www.google.com");However I want to display a HTML file that is stored locally on my machine.
    I have tried the following but cant get it to find the stored page:
    page_jep.setPage("file:///index.htm");
    java.io.FileNotFoundException: \index.htm (The system cannot find the file specified)I have tried putting the index file in both the root directory ( C ) and also the same place as where the class files are.
    Any help will be gratefully received,
    Harold Clements

    Nope, I have tried it:
    page_jep.setPage("file://c:\\index.htm");Gives me:
    java.net.UnknownHostException: c

  • What is the maximum size of a .swf flash file that can be created for DMM

    Please help,
    I am running DMM 5.2.1 and was wondering what is the maximum size of a .swf file that can be created and play SMOOTHLY on the screens (screen dimension 1366 x 768px).
    Kind regards.

    Hi Nicholas,
    You can refer to the content creation best practices documented at the following link:
    http://www.cisco.com/en/US/docs/video/digital_media_systems/5_x/5_2/dmd/best/practices/guidelines.html#wp1168116
    As you can read there:
    - if the SWF file size is greater than 500KB, you may start to see high memory consumption on the DMP.
    - regarding resolutions, the SWF can be up to 1920 x 1080 when animations within the SWF are small and are restricted to a 640x480 region.
    Regards,
    Marco

  • I have a coleman Trek camcorder that creates AVI files, how can I get iMovie on my Macbook Pro to read these files?

    I have a Coleman TREK camcorder that creates AVI files, how can I get iMovie on my MacBook Pro to Read thes files?

    Try the following. there are others too
    https://itunes.apple.com/us/app/free-video-converter/id464195348?mt=12

  • Can I use Photoshop Elements 13 to create HTML file?

    Can I use Photoshop Elements 13 to create HTML file?

    See Barbara's answer in your duplicated post: How can I save a Photoshop Elements 12 file as HTML?
    No difference with PSE13.

  • How do i create a stensil that can be added into diffrent files of adobe reader?

    I want to create a stencil that can be used in multiple adobe files for quality check purpose. Will be helpfull if somebody helps me out on this.

    why are you saying
    Pat Willener wrote:
    Please stay in your own topic, and answer the questions asked!

  • Why does DW CC 2014.1 Fluid Grid load HTML file that contains Google Analytics Tracking Code script so slowly?

    I exclusively work in Fluid Grid since my site is a Responsive Web Design.  I'm having trouble with slow load time in DW CC 2014.1, when my file, as they all do of course, has the Google Analytics Tracking Code script.
    I'm on a Windows 8.1 using a Dell Precision M3800 Laptop with Memory 16GB (2x8GB) 1600MHz DDR3 . Each of our site's 180 or so web pages, of course, has its Google Analytics Tracking Code script. It is placed, following Google instructions, as the last entry in the <head>.  Google Analytics does not instruct to place the script in the JS Folder with an scr to it, but rather in the <head>.  It takes up to one and a half or two minutes for DW CC 2014.1 to load the Google Analytics Tracking Code script .  That is, the grid does not show in Live View until finally analytics.js shows up in the Document Toolbar. A minute or two can add up when every page you load takes this long.  And, making new Fluid Grid pages, as is done, through the Save As command; every new page made you have to deal with the minute or two wait time since all those pages have the Google Analytics Tracking Code script.  Therefore, this time component alone, assuming I'm accessing and/or making 20 pages per week (and in our business this is easily the case) the math is that I'm wasting between 17 and 35 hours per year just with DW CC 2014.1 loading the much needed Google Analytics Tracking Code script.
    I have loaded HTML files that do not have the Google Analytics Tracking Code script as a test and those files load at the normal quick speed.
    Therefore, the new Chromium Embedded Framework browser engine has a serious load problem when it confronts an HTML5 file with a Google Analytics Tracking Code script.  Oddly, the prior DW CC 2014 version, with the old browser engine did not have this slow-load problem since I was loading these same files in that DW CC version up until October 8th or so.
    I think this new browser engine is a Google platform that apparently has a problem rendering or loading a Google Analytics Tracking Code script.  That makes no sense.
    Anyone else had this particular slow-load problem with DW CC 2014.1?
    Thanks.

    Wow.  That sure solved the slow-load problem, at least using your suggested snippet in a simple test HTML file.
    Per Google's instructions, I pasted the snippet before the closing </head> tag.  And, even in that positioning in the file; the file loaded at the speed (about one second) that it did prior to DW 2014.1.
    Two questions.
    Will this snippet provide the same tracking data as my current GA snippet?
    Because my current GA snippet is in about 200 web pages, can I retain the old snippet in most of them and place the new snippet in my approximately 5 main web pages as well as my templates so my new pages, as well as my main pages, have the new snippet.  That is, can I have both snippets (i.e. old snippet in earlier pages and new snippet in main pages and new pages to be made going forward) in my website at the same time?
    Of course I would not have both the old and new snippet in a web page at the same time.
    I greatly appreciate any assistance anyone can provide me on this issue and thank all of you in advance.
    I've provided code for both simple test files below.
    Code for Asynchronous Syntax of GA script:
    <!doctype html>
    <!--[if lt IE 7]> <html class="ie6 oldie"> <![endif]-->
    <!--[if IE 7]>    <html class="ie7 oldie"> <![endif]-->
    <!--[if IE 8]>    <html class="ie8 oldie"> <![endif]-->
    <!--[if gt IE 8]><!-->
    <html class="">
    <!--<![endif]-->
    <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Test Asynchronous GA Tracking Code In Head</title>
    <link href="css/boilerplate.css" rel="stylesheet" type="text/css">
    <link href="/css/style.css" rel="stylesheet" type="text/css">
    <!--
    To learn more about the conditional comments around the html tags at the top of the file:
    paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither/
    Do the following if you're using your customized build of modernizr (http://www.modernizr.com/):
    * insert the link to your js here
    * remove the link below to the html5shiv
    * add the "no-js" class to the html tags at the top
    * you can also remove the link to respond.min.js if you included the MQ Polyfill in your modernizr build
    -->
    <!--[if lt IE 9]>
    <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
    <![endif]-->
    <script src="js/respond.min.js"></script>
    <script type="text/javascript">
      var _gaq = _gaq || [];
      _gaq.push(['_setAccount', 'UA-73425000-1']);
      _gaq.push(['_trackPageview']);
      (function() {
        var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
        ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
        var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
    </script>
    </head>
    <body>
    <div class="gridContainer clearfix">
      <div id="div1" class="fluid">
        <div id="test1" class="fluid ">This is the content for Layout Div Tag "test1"</div>
       <div id="test2" class="fluid ">This is the content for Layout Div Tag "test2"</div> 
    </div>
    </body>
    </html>
    Code for older GA script snippet:
    <!doctype html>
    <!--[if lt IE 7]> <html class="ie6 oldie"> <![endif]-->
    <!--[if IE 7]>    <html class="ie7 oldie"> <![endif]-->
    <!--[if IE 8]>    <html class="ie8 oldie"> <![endif]-->
    <!--[if gt IE 8]><!-->
    <html class="">
    <!--<![endif]-->
    <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Test GA Tracking Code In Head</title>
    <link href="css/boilerplate.css" rel="stylesheet" type="text/css">
    <link href="/css/style.css" rel="stylesheet" type="text/css">
    <!--
    To learn more about the conditional comments around the html tags at the top of the file:
    paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither/
    Do the following if you're using your customized build of modernizr (http://www.modernizr.com/):
    * insert the link to your js here
    * remove the link below to the html5shiv
    * add the "no-js" class to the html tags at the top
    * you can also remove the link to respond.min.js if you included the MQ Polyfill in your modernizr build
    -->
    <!--[if lt IE 9]>
    <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
    <![endif]-->
    <script src="js/respond.min.js"></script>
    <script>
      (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
      (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
      m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
      })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
      ga('create', 'UA-73425000-1', 'auto');
      ga('send', 'pageview');
    </script>
    </head>
    <body>
    <div class="gridContainer clearfix">
      <div id="div1" class="fluid">
        <div id="test1" class="fluid ">This is the content for Layout Div Tag "test1"</div>
       <div id="test2" class="fluid ">This is the content for Layout Div Tag "test2"</div> 
    </div>
    </body>
    </html>

  • Include an HTML file that needs parameters??

    I have a JSP that includes an HTML file template.
    Lets say I don't know all the contents of the HTML at the time. How do I add it?
    Simple Example:
    myHTML.html
    <HTML>
    <HEAD>
      <TITLE>myVariablePassedFromJSP</TITLE>
    </HEAD>
    <BODY></BODY>
    <HTML>myJSP.jsp
      String title = "My Title To Display";
      <%@ include file="myHTML.html" %>
      etc...and the result should be
    <HTML>
    <HEAD>
      <TITLE>My Title To Display</TITLE>
    </HEAD>
    <BODY></BODY>
    <HTML>

    If the included file can be a JSP instead of a plain HTML file you can use the <jsp:include> tag with parameters. The parameters will become request parameters in the included JSP. You can use them anywhere in the JSP.
    e.g.
    *** 1.jsp ***
    <jsp:include page="2.jsp" flush="true">
    <jsp:param name="title" value="the window title" />
    <jsp:param name="someBody" value="something for the body" />
    </jsp:include>
    *** 2.jsp ***
    <HTML>
    <HEAD>
    <title><%= request.getParameter("title") %></title>
    </HEAD>
    <BODY>
    <%= request.getParameter("someBody") %>
    </BODY>
    </HTML>
    Be careful with includes because you can end up with multiple conflicting tags. For example, if 1.jsp has <html>, <head>, and <body> tags, and 2.jsp does, too, then you may run into a problem.

  • What is the maximum number of 263 byte text files that can fit in a folder?

    what is the maximum number of 263 byte text files that can fit in a folder - on a windows 2000 operating system?
    I created a java program that creates these text files.
    It was set to loop 30,000 times.
    It created a total of 21874 html files before throwing a null exception.
    I tried to copy and paste 10 more html files manually and it said not enough disk space.
    however, I made a New Folder in that same folder and I was able to successfully paste the folders in
    there.
    That's interesting.
    It appears there is a size limit in each folder, BUT I can make another folder within that and successfully paste more html files in there
    Does anyone know the rules governing this feature.
    Stephen

    Whatever the answer is, it has nothing to do with Java programming. Microsoft might know, though, and that's where you should look.

  • How can I import a movie into iMovie 09 from a hard drive?  The movie will open and play in idvd but breaks into separate files that can't be downloaded when I try to import.  Can it be done?

    How can I import a movie into iMovie 09 from a hard drive?  The movie will open and play in idvd but breaks into separate files that can't be downloaded when I try to import.  Can it be done? I am trying to create a disc of player highlights for a collegiate coach, and I am using movie files downloaded to my hard drive from a DVD created on a PC. 

    No unfortunately it won't open in quicktime either.  It does the same thing that Imovie does, separates it into two file folders audio and video, and if i select video it opens to reveal 8 files that cannot be selected.  VIDEO_TS.BUP, VIDEO_TS.IFO, VIDEO_TS.VOB,VTS_01_0.BUP, VTS_01_0.IFO, VTS_01_1.VOB, VTS_01_2.VB, VTS_01_3.VOB.  All of which cannot be opened or selected.
    Opening it in Idvd and folllowing your suggestion works and I get a format code of NTSC.  Is that the same?  Thank you for your time and response.
    CaCanuck

  • Is it possible to embed a file that can be opened with another app in IBA?

    We're making a music instructional book and would like to "embed" a .tef file that can be opened by the free tefPad reader:
    https://itunes.apple.com/us/app/tefpad/id517830471?mt=8
    I don't think it is possible, but wanted to see if there is some trick we haven't found.
    Thanks much for any insights.

    Check  the iBooks Author,      > Help  > Media and Graphics and  / or if you an iTunes Connect account, open and > > Deliver your Content on the right of  some  of the options are links to a number of PDF, Asset Guides, Formatting guides etc,.
    iBooks Authur has a few  widgets and  there are  many thrid party widget  makers online such as Bookry, who  may also be able to create what you want if its technically possible - at a price.

  • (Administration - Marketing - Import), you can set a parameter value "Import mode" for what to do in case of duplication as "update existing records", "Import new records". The final report of this import is presented as a text file that can be viewed in

    Administration - Marketing -> Import, you can set a parameter value "Import mode" for what to do in case of duplication as "update existing records", "Import new records". The final report of this import is presented as a text file that can be viewed in Business Administration - Marketing -> Import -> Exceptions. Whatever the exception, including duplication import occurs during import and recorded in a text file.   What are the fields that determine the duplicity? How I can I can change those?

    You will be returned anything that is in the option's value parameter. What is displayed in the dropdown and what is put in the value attribute do NOT need to be the same, so maybe you should start there.

  • I have Dreamweaver CS3 on a PC with Windows Vista SP2. The program recently began to hang when opening previously created HTML files. How do I fix this?

    I have Dreamweaver CS3 on a PC with Windows Vista SP2. The program recently began to hang when opening previously created HTML files. How do I fix this?

    Hi rmarchione,
    Can you try restoring preferences and let us know if it helps?
    Restore preferences | Dreamweaver CS4, CS5, CS5.5, CS6
    Thanks,
    Preran

  • What is the easiest way to get the data from the mailmerge to form Pages files that can be saved separately?

    Using Iwork 09 I have spent several hours setting up a mail merge from a spread sheet in Numbers to create receipts for my customers from a Pages template.
    After the merge I am left with one long Pages document that will not save as separate files; one per customer, it will only save the whole document of several receipts.
    What is the easiest way to get the data from the mailmerge to form Pages files that can be saved separately?
    Many thanks in advance.
    Richard

    Mr. Clark,
    You will probably be more pleased with the iWork apps when you begin to learn your way around. Until you learn such basic things as how to print only one page of a document, you will probably continue to be disappointed.
    Does your Print dialog look like this:
    Or like this:
    If it looks like the first one, then you will want to click this expander control:
    Regards,
    Jerry

Maybe you are looking for