How to Set "file.encoding" System Property to default "UTF-8"

When i execute my code some special character are not being display correct so by programming approach i am trying to set "file.encoding" system property to "UTF-8", using command System.setProperty( "file.encoding", "UTF-8" ); and it is not working.
If i run my jar using command java -Dfile.encoding=UTF-8 -jar myprog.jar . It is working and my special characters are also looking in right way.
Can i set this defalut encoding by programming approach.
Thanks
Ashish Pancholi

Hello,
I have the same problem. I have a java prog that is started with "-Dfile.encoding=ISO-8859-1". Now in this program I want to print some characters using the UTF-8 encoding because I know that the terminal I will be printing on has this encoding. I tried using InputStramReader without success:
    InputStreamReader isr = new InputStreamReader(new ByteArrayInputStream("Müller".getBytes()), "UTF-8");
    BufferedReader br = new BufferedReader(isr);
    String line = null;
    while ((line = br.readLine()) != null) {
        System.out.println(line);
    }EDIT:
the above example is to read something into my java program. If I want to write something from my java class to an output it goes like this:
Writer out = new BufferedWriter(new OutputStreamWriter(System.out, "UTF8"));
out.write("Müller\n");
out.flush();... in that case I get the correct encoding.
Thanks,
T

Similar Messages

  • How does JVM set file.encoding system property?

    The system property file.encoding is changed mysteriously, and we don't have a command line -D option. How does JRockit JVM get the default value for system properties such as file.encoding?
    I am running Jrockit 1.4.2_12.
    Thanks.

    I am running WLS 8.1SP6 on Linux using Jrockit 1.4.2-12. Over the weekend, I bounced WL server, and file.encoding was changed. It used to be ISO-8859-1. Now it is ANSI_X3.4-1968. Neither System Administrator nor WebLogic (farm) Administrator changed anything. Although I can force it with -D, I'd like to figure out what happened.
    Thanks.

  • Problem with file.encoding system property

    Hi all
    I develop a web application with Tomcat app server.
    I have to set file.encoding system property to "Cp1252", but when I set it programatically using System.setProperty("file.encoding","Cp1252") it doesnt affect to my program outcome but when I put it in catalina.bat with set JAVA_OPTS=-Dfile.encoding=Cp1252 it works fine.
    what is the differences and why I cant change that property programatically?
    thanks

    why I cant change that property programatically?It is a system property reflecting the initial settings read when the JVM started. Resetting the system property java.home will not change your home directory either.

  • How to set File Encoding to UTF-8 On Save action in JDeveloper 11G R2?

    Hello,
    I am facing issue when I am modifying a File using JDeveloper 11G R2. JDeveloper is changing the Encoding of the File to System default Encoding (ANSI) instead of UTF-8. I have updated the Encoding to UTF-8 in "Tools | Preferences | Environment | Encoding" option and restarted the JDeveloper. I have also updated "Project Properties | Compiler | Character Encoding" option to UTF-8. None of them are working.
    I am using below version of JDeveloper,
    Oracle JDeveloper 11g Release 2 11.1.2.3.0
    Studio Edition Version 11.1.2.3.0
    Product Version: 11.1.2.3.39.62.76.1
    I created a file in UTF-8 Encoding. I opened it, do some changes and Save it.
    When I open the "Properties" tab using "Help | About" Menu, I can see that the Properties of JDeveloper are showing encoding as Cp1252. Is it related?
    Properties
    sun.jnu.encoding
    Cp1252
    file.encoding
    Cp1252
    Any idea how to make sure JDeveloper saves the File in UTF-8 always?
    - Sujay

    I have already done that. That is the first thing I did as mentioned in my Thread. I have also added below 2 options in jdev.conf and restarted JDeveloper, but that also did not work.
    AddVMOption -Dfile.encoding=UTF-8
    AddVMOption -Dsun.jnu.encoding=UTF-8
    - Sujay

  • How to set file watcher

    I want to know how to set file watcher for my sql database using java.
    my doubt is i am running an web application in a web server.
    the user information are stored one databse.
    i want that user details in other databases.
    it will do automatically.
    when ever new values are stored one database then automatically that value transfered in other data base.
    i want urgent.
    please help me
    thanks

    It seems like the most natural way to do that would be with database triggers, if your DB allows its triggers to interact with the world outside the DB--e.g. invoking Java code, invoking some other process, opening a socket, etc.

  • How to set the fiscal year period as default in variables

    Hi All,
    How to set the fiscal year period as default it shoud take previous period when the report is executed.
    And also I need to do the same changes in reporting agent.
    Could you please any one help me.
    Points will be given.
    Thanks!
    Best regards,
    Ajay.

    Hi Ajay,
    Create a customer exit variable.Write the code in the include 'zxrsru01' using system date.
    take the system date from the system date variable and using that you can get the current fiscal year period.use this value and using string commands, you can get period.
    subtract 1 from this value.Using this you can get the previous fiscal period..
    Please let us know, if you need the coding part
    Hope it helps
    Thanks,
    Teja

  • TS1574 How do set my Built-in microphone to default?

    I am using a OS X Version 10.9.1 and i want to know how to set my Built-in Microphone to Default it's a simple question and no one seems to have an answer 

    Ok i can hear my voice now but the settings for the Built-in Microphone are not the same as before

  • Setting up java.system.property in WL 6.0

    Hi all,
    I just installed Web Logic 6.0. I would like to know if anyone knows how
    to set java.system.property in Web Logic 6.0
    In old Web Logic 5.1, I added this line in weblogic.properties file. Now
    since we don't have weblogic.properties file anymore, I am assuming this
    should go in config.xml. Documentation says I should use Admin Console
    to modify config.xml and to convert old weblogic.properties file, but I
    found Admin Console confusing.
    My Web Logic 6.0 is installed on d:\bea\. I clicked on Convert
    Weblogic.properties and I see directories on my system. I click on icon
    to get the directory that has weblogic.properties file. Then I get page
    that ask me to pick Clusters and Server and I have no idea what
    directory I need to click on
    If someone knows what to do next or how to edit Config.xml so that I can
    add my java.system.property, please e-mail me
    Thanks in advance
    Qaiser

    Did you see the directions on page 3-11 of the WLS 6.0 Administration Guide? I
    followed these steps, and was able to create a new domain. I found them to be
    clear.
    Laurel
    "Jesper de Jong" <[email protected]> wrote:
    >
    Hello all,
    Instead of working with "mydomain" and "myserver" I want to create my
    own domain.
    IMHO, the documentation on e-docs is not very clear on the steps that
    are necessary
    to do this.
    What are the steps, or where can I find better documentation on creating
    a domain?
    regards,
    Jesper

  • How to Set File Handling on LIghtroom CC??

    I was watching a you tube on Lightroom CC and the person is using a mac - I am on WIndows.  The insructor selected the words "lightroom" to the left of "File" to get to catalogue settins.  I don't see that option so that I can set file handling etc for preview size etc.  I have already updated from my LR5 catalogue.  So, how do I nagivate to these options and also how to navigate to set program to use my vidoe card for faster performance.  Thank you.

    I have already done that. That is the first thing I did as mentioned in my Thread. I have also added below 2 options in jdev.conf and restarted JDeveloper, but that also did not work.
    AddVMOption -Dfile.encoding=UTF-8
    AddVMOption -Dsun.jnu.encoding=UTF-8
    - Sujay

  • Cannot set a weblogic system property in batch

    Hello All,
    I'm running an weblogic application on weblogic 8.1 SP1. The application uses
    UTF-8 data from a mssql database. The problem is that weblogic 8.1 SP1 does not
    show UTF-8 data correctly. I've read docs and found that in order to make sure
    that weblogic's output is in UTF-8 I can configure a weblogic system property
    like that:
    add -Dweblogic.webservice.i18n.charset="utf-8" into JAVA_OPTIONS in startweblogic.cmd
    batch file. But during the process of starting it shows me the following:
    <10.10.2003 20:08:50 NOVST> <Warning> <Management> <BEA-141087> <Unrecognized
    pr
    operty: webservice.i18n.charset.>
    I also do not see changes in weblogic's behaviour (IMHO it should add charset=utf-8
    to Content-type header of each response to clients.
    However on weblogic 7.0 SP1 everything works without adding this option, but when
    I add it the server claims again that it's unrecognized and I see no effect in
    the HTTP headers of the server response.
    PLease help me to investigate this issue!
    Thanks for any help
    Dmitry.

    Hello,
    You are setting the charset value (UTF-8) correctly. The <Warning>
    message from the server startup can be safely ignored.
    The server should respond to the charset provided by the client. You
    can also set the charset on the web service using charset attribute of
    the <web-service> element in the web-services.xml file. See:
    http://e-docs.bea.com/wls/docs81/webserv/i18n.html
    Have you tried setting the "-Dweblogic.webservice.i18n.charset=utf-8" on
    the client?
    Use the "-Dweblogic.webservice.verbose=true" flag to help diagnose this
    issue. See: http://e-docs.bea.com/wls/docs81/webserv/trouble.html
    Hope this helps,
    Bruce
    Dmitry wrote:
    >
    Hello All,
    I'm running an weblogic application on weblogic 8.1 SP1. The application uses
    UTF-8 data from a mssql database. The problem is that weblogic 8.1 SP1 does not
    show UTF-8 data correctly. I've read docs and found that in order to make sure
    that weblogic's output is in UTF-8 I can configure a weblogic system property
    like that:
    add <Warning> into JAVA_OPTIONS in startweblogic.cmd
    batch file. But during the process of starting it shows me the following:
    <10.10.2003 20:08:50 NOVST> <Warning> <Management> <BEA-141087> <Unrecognized
    pr
    operty: webservice.i18n.charset.>
    I also do not see changes in weblogic's behaviour (IMHO it should add charset=utf-8
    to Content-type header of each response to clients.
    However on weblogic 7.0 SP1 everything works without adding this option, but when
    I add it the server claims again that it's unrecognized and I see no effect in
    the HTTP headers of the server response.
    PLease help me to investigate this issue!
    Thanks for any help
    Dmitry.

  • As a webservice client, how to set character encoding for JAX-WS?

    I couldn't find the right API to set character encoding for a webservice client. What I did is
    1, wsimport which gives me MyService, MyPortType...
    2. Create new MyService
    3. Get MyPort from MyService
    4. Call myPort.myOperation with objects
    Where is the right place to set character encoding and how to set it? Thanks.
    Regards
    -Jiaqi Guo

    The .js file and the html need to have the same encoding. If
    your html uses iso-8859-7, then the .js must also use that. But if
    the original text editor created the .js file using utf-8, then
    that is what the html needs to use.

  • How to set the read only property for dynamic ALV column

    Hi All,
    I have built one dynamiv ALV and I have one name column inside that ALV for which I have to set read only property based on two column fields that exist in the same ALV,say IS_SP and IS_CORP of type boolean.
    If any one of the flag is 'X',i have to make that name column as display only and
    If both flag are not set,it should be displayed as ediatable column.
    I have written one method as INIT_ALV which gets called when ALV is loaded.
    Code is as  follows:
      lr_column_settings ?= wd_this->alv_all_roles.
      lt_columns = lr_column_settings->get_columns( ).
    LOOP AT lt_columns INTO ls_column.
    CASE ls_column-id.
       WHEN <NAMECOLUMN>. "name column which should be editable/display
    Create Input Field
            CREATE OBJECT lr_uie_input_field_ro
              EXPORTING
                value_fieldname = ls_column-id.
         ls_column-r_column->set_cell_editor( lr_uie_input_field_ro ).
        After this,I have to set the read only property based on IS_SP and IS_CORP values,
              CALL METHOD lr_uie_input_field_ro->set_read_only_fieldname
              EXPORTING
                *value = 'IS_SP' or 'IS_CORP'
    ENDLOOP.
    I dont want to use cell variants also.
    Help me to achieve this.
    Thanks and Regards,
    Divya

    Divya - I have done it in the past following these documents. Please read it and try it it will work.
    Please read it in the following order since both are a continuation documents for the same purpose (it also contains how to change colors of row dynamically but I didnt do that part I just did the read_only part as your requirement) 
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/f0625002-596c-2b10-46af-91cb31b71393
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/d0155eb5-b6ce-2b10-3195-d9704982d69b?quicklink=index&overridelayout=true
    thanks!
    Jason PV

  • How to set "Maximum Lenght" column property for database block at RUNTIME?

    Hi folks,
    Is it possible to somehow set a "Maximum Length" property for database block column at runtime?
    I have a dynamic form, which maintains mostly "STATIC DATA" within all application which are stored in different static data tables (which have similar structure). But now, description column in some of those tables was extended (not in all at this stage). I would like to avoid truncating form error while reading data from those extended tables, so I would like to set an MAXIMUM SIZE to accurate value at the time when I'm specifying TABLE NAME for that database block.
    What property should I use to set it?
       -- before executing query in "MAIN_BLOCK" I always set QUERY_DATA_SOURCE_NAME to user defined value => STATIC DATA TABLE name
       Set_block_Property('MAIN_BLOCK',QUERY_DATA_SOURCE_NAME,:control.table_name);
       Set_block_Property('MAIN_BLOCK',DML_DATA_TARGET_NAME,:control.table_name);
       -- here I would like to set also MAXIMUM LENGHT for particular column (based on some condition, etc.. correct value I can get from ALL_TAB_COLS dictionary
       SET_ITEM_PROPERTY('MAIN_BLOCK.DESCRIPTION', <<XXXXXXX>>, 300);What should I use instead of "<<XXXXXXX>>" if I want to overwrite MAIN_BLOCK.DESCRIPTION column's maximum length to 300?
    Thanks,
    Tomas

    Hi Magoo, thanks for reply.
    Yes, but then user can get other errors while trying to set description with value longer than in database (for all not extended tables).
    Aby idea how to implement SET_CUSTOM_PROPERTY like mentioned here?
    Oracle Forms - "maximum length" property.
    Thanks,
    Tomas

  • How to get file encoding type

    Hi ,
    How to get the file encoding type,
    for example file is saved with the .txt and encoding is utf-8 and another file is saved .txt with encoding is ascii,
    actually before reading the file i want idetify the encoding type
    please help me it is very urgent for me..
    thanks in advance

    As there is no established regime for signing most encoding types, the only way to do this is to start parsing the file in one encoding, see if you get something that makes sense, and if not try another encoding, and so on. I.e. you have to code it yourself and even then it is not usually reliable. Sorry.
    Drake

  • How to set the disable,visible property in declarative components.

    We have used one declarative component. It consists of 5 buttons (add,delete,save,delete,print). In all of our pages, this declarative component is used. We could bind methods and was able to use each pages seperately (by linking the methods in the backing bean)
    But for implementing the DISABLE,VISIBLE properties, we have added the attributes for this and refered this to the corresponding disable and visible property of the button. In the page all these properties where reflected. But at the runtime these buttons are not coming.
    Can anyone advise how can we set the disable,visible property in declarative components.

    Hi vikram ,
    i hvnt initialized the properties ,
    in my declarative component i have one button say Save button and i want to config 2 properties Disable and Visible
    i added two attributes ( java.lang.Boolean ) say disablr_btn ,*visible_btn* and mapped wth the Save button Properties Disabled and Visible using expressions
    Now the button is invisible while running the page.
    if i remove the mapping from properties Disable and visible , the button is visible
    should i init the properties in faces config , i dnt knw hw to init the properties
    pls advice

Maybe you are looking for

  • I just upgraded to Firefox 4. Now my cursor doesn't "snap-to" the default position.

    I just upgraded to Firefox 4. Now my cursor doesn't "snap-to" the default button. I made sure it was newly recognized (by unchecking and rechecking) in Control Panel > Mouse > Pointer Options > Snap To: Automatically move pointer to a default button

  • How do I stop the menu from showing up when I hover to the top of a full screen app?

    I am running Parallels in full-screen on Lion and when I move the cursor towards the top of the full screen app the menu pops up. How do I stop the menu from popping up? I keep hitting an icon on the menu bar that pulls it out of full screen mode and

  • USB SuperDrive:  Double-layered?

    Hi, all: Will the USB SuperDrive I bought with my MacBook Air burn double-layered DVD's? I ask because the movie I made in iMovie '11, and then shared to iDVD, is about 8 GB in size. Thanks, Bill in CT

  • Screensaver of my Dreams

    This is probably an unusual question. I have a very large collection of images on my computer that I use for creative inspiration; anything from great photography and art to personal photos and funny internet memes. I love watching them using the scr

  • How to automate Brushes in Illustrator CS2

    Hi All, How to automate Brushes in Illustrator CS2 like getting the Brush name,Deleting a brush etc .Which header file & Member function should i use ?can any one give me any code snippets? IDE:Microsoft Visual Studio .net 2003 Thanks in Advance myRi