File.encoding in windows influence  by the locale

How can I set the file.encoding in windows platform that will not be influence by the locale.
For example, in the Control Panel->Regional Options the locale is set to Russian
and what I get is that I use file.encoding Cp1251 even though I pass the parameter in the command line
-Dfile.encoding=Cp1252 (I want to keep Cp1251,
Cp1251 is US westen default and Cp1252 is Windows Cyrillic)
I run java program to see what encoding I use
D:\ProgramFiles\jdk1.3.1\bin\java -Dfile.encoding= Cp1252 TestEncodingThe locale in my pc is Russian and the result is:
System.getProperty("file.encoding") == Cp1252
Default ByteToChar Class == sun.io.ByteToCharCp1251
Default CharToByte Class == sun.io.CharToByteCp1251
Default CharacterEncoding == Cp1251
OutputStreamWriter encoding == Cp1251
InputStreamReader encoding == Cp1251
TestEncoding.java
import java.io.PrintStream;
import java.io.ByteArrayOutputStream;
import java.io.OutputStreamWriter;
import java.io.InputStream;
import java.io.ByteArrayInputStream;
import java.io.InputStreamReader;
class TestEncoding{
public static void main(String[] args) {
String encProperty = System.getProperty("file.encoding");
System.out.println("System.getProperty(\"file.encoding\") == " + encProperty);
String byteToCharClass = sun.io.ByteToCharConverter.getDefault().getClass().getName();
System.out.println("Default ByteToChar Class == " + byteToCharClass);
String charToByteClass = sun.io.CharToByteConverter.getDefault().getClass().getName();
System.out.println("Default CharToByte Class == " + charToByteClass);
String defaultCharset = sun.io.ByteToCharConverter.getDefault().getCharacterEncoding();
System.out.println("Default CharacterEncoding == " + defaultCharset);
ByteArrayOutputStream buf = new ByteArrayOutputStream(10);
OutputStreamWriter writer = new OutputStreamWriter(buf);
System.out.println("OutputStreamWriter encoding == " + writer.getEncoding());
byte[] byteArray = new byte[10];
InputStream inputStream = new ByteArrayInputStream(byteArray);
InputStreamReader reader = new InputStreamReader(inputStream);
System.out.println("InputStreamReader encoding == " + reader.getEncoding());

What are you really trying to accomplish? Applications should avoid relying on undocumented or implementation dependent features, such as the file.encoding property and sun.* classes (see http://java.sun.com/products/jdk/faq/faq-sun-packages.html).
On the other hand, there's plenty of documented public API that lets you work with specific character encodings. For example, you can specify the character encoding for conversion between byte arrays and String objects (see the String class specification) or when reading or writing files (see the InputStreamReader and OutputStreamWriter classes in java.io).
The default encoding is needed by the Java runtime when accessing the Windows file system, for example file names, so changing it would likely result in erroneous behavior.
Norbert Lindenberg

Similar Messages

  • How can a convert a file encoded Cp1252 (Windows Latin-1) to text file.

    please this is urgent
    could some one tell me how I can a convert a file encoded Cp1252 (Windows Latin-1) to a text file.

    I need to convert a file encoded in Cp1252
    (well that is what I get as when I invoke the method
    in.getEncoding())to a plain text file a readable format... (UTF8 format?? )so I that i can parse it with StringTokenizer...
    sorry for some missing part of the first message.
    thanks

  • The files in finder windows all have the same icon

    Hi, the files in finder windows all have the same icons. Sometimes the icon will change when I drop a new file in a window. But I have no control over that. Any cue?
    Thanks

    I also rebuilt the Launch Services Database. It worked for the icons already in folders (and finder windows), but when I put a file from the desktop in one of these folders, the file does not have the correct icon.

  • If I delete a file in iCloud, what happens to the local file in ~/Library/Mobile Documents ?

    If I delete a file in iCloud, what happens to the local file in ~/Library/Mobile Documents ? Does it get deleted to?
    Hope somebody can help.
    Thx.

    I'm pretty certain that it gets deleted as well. If you try and open that mobile documents folder, it takes you to the iCloud drive folder. I've been searching for this same issue for the last 24 hours also as I inadvertently deleted my Keynote files stored on iCloud drive thinking I was just temporarily deleting Keynote from my iPad when upgrading to the latest iOS 8 version. (I needed space and thought, "Oh, I'll just reinstall later... Turns out I was in the iCloud storage area, not in my iPad storage area at the time and therefore deleted all my iCloud stored presentations. From every device.)

  • How to send a file to a certain printer at the local network?

    Hello,
    Is there any Java API (standard or free packages) that allows to send a certain file from the filesystem to a certain printer at the local network, not necessarily the default one that the machine the code is running on is using? In case there is one, a code example could be nice...

    Hi Roy,
    There is a library part of the standard java for printing and searching printers. Have a look at the package
    javax.print
    A google search with the package name will lead to tutorials and code samples I guess.
    HTH
    Peter

  • Anyone know the syntax for printing-to-file for the file name in windows? Tried the following and it did not work...C:\Documents and Settings\Cal\My Documents\FolderForPrinting but I also put it in small quotes.

    Two issues I think.
    One is how a file is specified to print to.
    Second is how directories with spaces are allowed, and the detail for allowing spaces in directory or file names.
    This is an XP operating system from Windows.
    Firefox is the browser.

    Two issues I think.
    One is how a file is specified to print to.
    Second is how directories with spaces are allowed, and the detail for allowing spaces in directory or file names.
    This is an XP operating system from Windows.
    Firefox is the browser.

  • When viewing PDF files in a window in firefox the popup control bar for zoom, print,page up or down does not work. Any suggsetions other than stop opening up pdf files in a firefox window and have them open in adobe reader?

    Firefox 10
    Adobe Acrobat Plug in 10.0.0.396

    Perform the suggestions mentioned in the following articles:
    * [https://support.mozilla.com/en-US/kb/Template:clearCookiesCache/ Clear Cookies & Cache]
    * [[Using the Adobe Reader plugin with Firefox]]
    * [[Opening PDF files within Firefox]]
    Check and tell if its working.

  • Unable to set JVM file encoding to UTF-8 on Windows

    Hi,
    I am running Tomcat on 1.5.0_05 JRE. I tried several things to set the jvm file encoding to UTF-8 instead of the default Cp1252, but no luck yet.
    The most intuitive approach seems to be to use a JVM option like
    "-Dfile.encoding=UTF-8"
    but this does not seem to have any effect. I have a WinXP pro m/c. I saw some bug reports which seemed to indicate that changing the JVM file encoding is not an available feature....is that correct? I would really appreciate any help/pointers on this. I will post the solution if I find something in the meantime.
    Thanks,
    Sriram

    I am fail to set it too. I think it is better to separate the file.encoding into two, one for accept local OS, the other for compile .java and .jsp and so on files. So we can change it and the bugs will be decrease!

  • Jinitiator 1.3.1.2.6 on win 7 64 and win xp (different file.encoding)

    Hello,
    our customer has moved from windows XP to Windows 7 and he uses Jinitiator 1.3.1.2.6...
    In some "Forms" I have implemented a PJC to save datas from clob to local file system..
    But there is a problem....
    If I run the same application with Windows XP I get file.encoding=Cp1250 which is ok....
    If I run the same application with Windows 7 (64) I get file.encoding=CP1252 and here is the problem...
    Is there any way to run Jinitiator (or set up file.encoding to/with) Cp1250?
    Maybe is this a local problem with windows?
    thank you..

    First, I will start by saying that JInitiator was not intended to run on Win7, especially 64bit. So, it may be time to think about moving to the Java Plugin. Preferably one which is certified with your Forms version.
    To your issue, I suspect you need to change the "Region and Language" settings on the client machine. This can be found on the Control Panel. If that doesn't help, take a look at this:
    http://stackoverflow.com/questions/4850557/convert-string-from-codepage-1252-to-1250

  • Windows cannot load the user's profile but has logged you on with the default profile for the system.

    My Windows 7  crashed a couple days ago after a windows update, I got this message.
    Windows cannot find the local profile and is logging you on with a temporary profile. Changes you make to this profile will be lost when you log off.
    I restarted the machine and got this message
    Windows was unable to load the registry. This problem is often caused by insufficient memory or insufficient security rights.
    DETAIL - The process cannot access the file because it is being used by another process. for C:\Users\TEMP\ntuser.dat
    I checked the event Log I found these .
    Windows cannot load the user's profile but has logged you on with the default profile for the system.
    DETAIL - Only part of a ReadProcessMemory or WriteProcessMemory request was completed.
    Windows has backed up this user profile. Windows will automatically try to use the backup profile the next time this user logs on.
    Windows cannot load the locally stored profile. Possible causes of this error include insufficient security rights or a corrupt local profile.
     DETAIL - The process cannot access the file because it is being used by another process.
    This is the first error in the event viewer after a successful logon
    The description for Event ID 34 from source ccSvcHst cannot be found. Either the component that raises this event is not installed on your local computer or the installation is corrupted. You can install or repair the component on the local computer.
     If the event originated on another computer, the display information had to be saved with the event.
    ccSetMgr
    Windows cannot load the user's profile but has logged you on with the default profile for the system.
    DETAIL - Access is denied.
    Looking at the Logs all I can tell is that after the Desktop Window Manager started if caused this error.
    The winlogon notification subscriber <SessionEnv> was unavailable to handle a notification event.
    then this one
    The Desktop Window Manager has exited with code (0x40010004)
    Then this before it shutdown.
    The User Profile Service has stopped.
    I started up the PC and the first message I got was
    How can I get access to my user profile? do I need to createa new Administrator account? Please help
    The EventSystem sub system is suppressing duplicate event log entries for a duration of 86400 seconds. The suppression timeout can be controlled by a REG_DWORD value named SuppressDuplicateDuration under the following registry key: HKLM\Software\Microsoft\EventSystem\EventLog.

    hi do the following
    1. In Search programs and files (Windows 7) area, type in regedit, and press Enter.
    2. If prompted click yes,
    3.  expand the following HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList
    4. click the sid that related to your admin profile (if you not sure, click each sid and in turn look to the right hand side of registry editor it will show who that sid is related to one of the registry files should hae in description localhost\admin or
    something similair)
    5. right click the sid and press delete.
    6. restart your machine and log back on with the admin account, this will then rebuild the admin profile... dont worry when it loads and none of your personal settings are saved or files or folders... go to c:\users
    in here you will see two folders for the admin account, one will be just admin and the other most likely admin.localhost
    i cant remember which one is which but just check both, one will still have all your files and folders in it.
    i suggest making a backup of your data before doing this incase something does go wrong, but ive had this happen many times in a domain enviorment and has worked for me everytime.

  • Can copying a file from a Xsan volume seen thru local sharing then  be...

    I'm told this and wonder:
    The xsan is mounted on computer A. Computer B connects to computer A and copies a file off the Xsan that is visible because computer A is connected to it.
    My associate says those files copied this way that were then copied to a DVD and sent to a client are unreadable. Is this possible? Even if the metadata is missing a file (photoshop psd or tif) should still have permissions that allow it to be opened, or not?
    thanks
    alan

    If the permissions were set to some local user on your network and you sent those files on DVD to someone else the local users on that system would still be able to open them (first local user is 501 on every mac). As long as the files weren't encrypted it shouldn't be a problem. In the absolute worst case the local admin account could change or reset the permissions, instead of unknown UID if a strange OD account was the source.

  • HT4576 I want to set up appointment times for an overseas trip before I go, and see those local times in the places I visit, but also be able to set new appointments while I am traveling, in the local times.  Can I do this with Time Zone Support?  If not,

    I want to set up appointment times for an overseas trip on my iPhone 4S before I go, and have them appear as I put them in (for the local time) when visiting other countries.  I also want to be able to adjust times and set up new appointments when I am overseas for the local time.  Can I do this using the Time Zone Support or any other way? 
    Basically I want to do what I can do with a piece of paper - write down the time for when I will be there, and have it viewable when I am there, but also be able to put down new times while there.

    Hi.
    Regarding your question about reverting back- yes, I think you can. If you make a backup of your current configuration in Server Admin (by dragging the configuration file to your desktop- cool, no?) then you can load that one back in should your configuration not work. If you have the manual from Apple it should describe this process.
    Network speed post-op? I don't think you will need to worry. Even using home directories stored on our OS X Server there is no network slowdown (that you can notice or that impacts the wider LAN in any case). It shouldn't slow down access to files, applications (which still come from the local drive anyway) or individual internet connections (even with filtering).
    In our experience some of these things have actually got faster- but a lot of that is user perception. Same goes for people who will know you have configured the server and that they are now accessing files through your network from the server, and who really think it is slower. File coming from your local hard drive will always be quicker- but network access isn't that bad that it will make you barf and run in the opposite direction.
    Something to look at: connection speed between clients and switching technology in your office. In other words, what kinds of switches are you using, what line speed have you got (100MB/s?) and is the connection from your server to the switch gigabit? Make sure it is.
    Enjoy
    Paul
    MacBook Pro 2.16GHz   Mac OS X (10.4.8)  

  • IDOC to File Port on Windows Server from Unix SAP System

    Hi All:
    I want to use an IDOC to create a text file on a Windows server. The SAP system runs on Unix. I have no problem creating the text file on the same Unix server running the SAP instance but I can not figure out how to write the file to a share or UNC path on a Windows server. I tried to create a logical file path using transaction FILE and then create a logical port in WE21. The IDOC failed because it is still looking on the Unix server to write the file. Any ideas from the community would be greatly appreciated.

    Hmmm, there are probably lots of ways to skin this cat.
    To make the process asynchronous you probably want to be along the lines of either updating a table or placing a file on the Windows machine, and then having a database process or Windows program to watch for the file or database table entry and triggering your bat file when it appears.

  • Cant get IMAQ write file 2 to ask user for the path.

    I am currently using an IMAQ write file 2 to create a .bmp image. I have the VI attached to a control path that allows the user to enter the path where they want to save the file. However I dont want the user to have to make sure they typed the path in before the IMAQ write file executes. I want the program to work so that when the IMAQ write file executes a window appears asking the user where they would like to save the file. If someone could help me out I would appreciate it thanks.
    Solved!
    Go to Solution.

    Use the File dialog VI under File I/O >> Advanced File Functions palette

  • Once Original Checked in, how it gets deleted from the Local PC automatical

    Hi Experts,
    Can someone help me regrding the following requirement:
    When the Originals are checked in into the content server, then the file should be deleted automatically from the Local PC. i.e. When we check in the original in the content serve, the same file which is there on the Local PC should gets deleted automatically.
    Is there a way to do it ?
    Thanks in advance.....

    Hi,
    Yes.. There is a way.. Go to dc30 - Workstation Application, Select one, for example PDF - Double click - Now you can see.. Check Delete Files after check-in.
    Regards,
    Aby

Maybe you are looking for

  • SBS 2003: Trying to find whether a mail was sent or not.

    Bit of a dispute going on in our company. We are trying to work out if an email was sent from one of our staff on a particular date. The other company has sent us a hard copy of the mail but there is no trace of the email in the user's email account

  • How to upload files in cluster without bringing down the cluster.

    Hi, Here is my problem: My weblogic portal 7.0 application should run in 24x7 environment. The production system is running in a cluster mode with external staging. Both the managed servers are pointing to the same application sync database. So to gi

  • Help on JRadioButton event

    While i was searching for a code sample for getting the selected radio button, I have found following method I have following method that returns selected radio button of a group.     public static JRadioButton getSelection(ButtonGroup group) {      

  • In Nautilus, mounted network shares not showing up right away

    I've noticed a strange problem recently (last couple of weeks) where my mounted network shares don't always show up right away in Nautilus (side bar or desktop- like they used to). For example, if I manually mount an NFS share in CL to /media/files i

  • Save data to server by an app

    Hi folks, I need to save some text, or an array, into a server... directly from my app developed in Adobe AIR using Flash (Action Script 3). Can you help me? Thank you so much! Cheers Brandon