Windows "Regional Options" locale - JCE for 8bit vs 16bit character sets

I have a Java application that reads in an Encrypted text file. The text file was Encrypted using JCE 1.2.1 and Encrypted on a Windows system with the locale set to English(US). The Encryption uses Sun's version of the DES encryption algorithm.
This app reads in the Encrypted text file and Decrypts it and processes it's information.
This works fine on Windows systems if the Regional Options control panel is set to a region that uses 8bit character sets:
- English
- Italian
- Spanish
- French
But, if the locale is set to 16bit character set regions, the text file cannot be read and parsed. Such regions include:
- Russian
- Greek
- English (Hong Kong)
At this point, I think I have two options, but I would love to hear about more:
- Edit the Encrypting/Decrypting code (or the parsing code - parses through a comma deliminated file) so that the file that is Encrypted and Decrypted can handle either an 8bit or 16bit character sets
(Don't know how to do this)
or
- Programatically change the locale of Windows machines to English(US) at application start-up and then change it back to the previous locale setting on application shut-down
(Don't know how to do this either)
I'd appreciate any help. I'm not sure if this is an International issue or an JCE issue.
Thanks in advance

I found an answer to the problem I was having.
The culprit were two special characters that the client was using in the encrypted text to distinguish between different fields and to distinguish carriage returns (� and �). The non Latin alphabet languages didn't know what to do with those characters so they substituted there own characters, thus breaking the parsing logic which was hard coded to look for � and �.
The problem also was related to the fact that the JCE works with byte[] arrays. FileInputStreams (which deal with byte[] arrays) seem to convert the special characters to new characters in non Lating languages to match what was going on in the JCE logic.
The easiest fix I could come up with, was to include a new properties file to be read by a separate FileInputStream. This properties text file contained just two characters (��). When I loaded in this new properties file via a FileInputStream, the two characters (��) in the properties file magically change to match the currently active alphabet (or didn't change at all if the computer was using a Latin alphabet).
By checking the new properties file to see what the characters had changed to (if they had), I was able to know what to use to parse the encrypted data. And as such, regardless of what language the computer was set to, the encrypted data is now parsed correctly, as I took out the hard coding that looked specifically for the characters � and � and instead rewrote the code so it now uses the characters from the properties file (or whatever characters they change to) for parsing the content data.
I hope others find this useful.

Similar Messages

  • Windows "Regional Options" locale (8bit vs 16bit character sets)

    I have a Java application that reads in an Encrypted text file. The text file was Encrypted using JCE 1.2.1 and Encrypted on a Windows system with the locale set to English(US). The Encryption uses Sun's version of the DES encryption algorithm.
    This app reads in the Encrypted text file and Decrypts it and processes it's information.
    This works fine on Windows systems if the Regional Options control panel is set to a region that uses 8bit character sets:
    - English
    - Italian
    - Spanish
    - French
    But, if the locale is set to 16bit character set regions, the text file cannot be read and parsed. Such regions include:
    - Russian
    - Greek
    - English (Hong Kong)
    At this point, I think I have two options, but I would love to hear about more:
    - Edit the Encrypting/Decrypting code (or the parsing code - parses through a comma deliminated file) so that the file that is Encrypted and Decrypted can handle either an 8bit or 16bit character sets
    (Don't know how to do this)
    or
    - Programatically change the locale of Windows machines to English(US) at application start-up and then change it back to the previous locale setting on application shut-down
    (Don't know how to do this either)
    I'd appreciate any help. I'm not sure if this is an International issue or an JCE issue.
    Thanks in advance

    I found an answer to the problem I was having.
    The culprit were two special characters that the client was using in the encrypted text to distinguish between different fields and to distinguish carriage returns (� and �). The non Latin alphabet languages didn't know what to do with those characters so they substituted there own characters, thus breaking the parsing logic which was hard coded to look for � and �.
    The problem also was related to the fact that the JCE works with byte[] arrays. FileInputStreams (which deal with byte[] arrays) seem to convert the special characters to new characters in non Lating languages to match what was going on in the JCE logic.
    The easiest fix I could come up with, was to include a new properties file to be read by a separate FileInputStream. This properties text file contained just two characters (��). When I loaded in this new properties file via a FileInputStream, the two characters (��) in the properties file magically change to match the currently active alphabet (or didn't change at all if the computer was using a Latin alphabet).
    By checking the new properties file to see what the characters had changed to (if they had), I was able to know what to use to parse the encrypted data. And as such, regardless of what language the computer was set to, the encrypted data is now parsed correctly, as I took out the hard coding that looked specifically for the characters � and � and instead rewrote the code so it now uses the characters from the properties file (or whatever characters they change to) for parsing the content data.
    I hope others find this useful.

  • Java time and windows Regional Option

    I want to return a time,so ,how is set on window's regional option.
    I set time on windows Regional Option so - 13:38:29, bat java return another format 1:38:29.
    for example. time is 13:40 PM on windows.
    Calendar date=Calendar.getInstance();
    date.get(Calendar.HOUR); this returns 1 not 13.
    What to do to return 13 not 1.

    Google (or even just the search box on this forum) is your friend:
    http://forum.java.sun.com/thread.jspa?forumID=16&threadID=318720
    http://forum.java.sun.com/thread.jspa?forumID=16&threadID=244377
    http://forum.java.sun.com/thread.jspa?forumID=16&threadID=544738
    http://forum.java.sun.com/thread.jspa?threadID=626159&messageID=9468678

  • Windows Explorer option not working for a Document library

    Dear All,
                I am SharePoint administrator for one of the SharePoint site ,When I try to open the document library in local drive using via "Windows Explorer"option I am facing below error.
               Can any one help me how can I over come from this issue
    Thanks,
    Sidd

    1. Check if you have sufficient permission on the document library and its documents.
    2. If permission is all correct, then the problem looks like in your file name. Check your File Name, Length, and Invalid Character Restrictions and Recommendations.
    For your reference: http://www.sysadminsblog.com/microsoft/file-name-length-and-character-restrictions-for-sharepoint/
    Please remember to upvote if it helps you or click 'Mark as Answer' if the reply answers your query 

  • Required setting for Locale values for Arabic db in oracle 10g

    I want to create a new db in Oracle 10g for storing the arabic data.
    My client machine is Arabic Windows XP.
    What are the steps that i will need to follow to make the db arabic supported.
    What streps will be required if i choose to make it unicode supported?
    Setting the following:-
    1. Set Database Character Set to AL32UTF8 for the Oracle Server.
    2. Set the NLS_LANG to ARABIC_LIBYA.UTF8 (on Arabic Windows xp)
    Will do the work?

    The database character set should be AL32UTF8 for Unicode support. This is a recommended setting.
    As far as NLS_LANG is concerned, this strongly depends on how your client application is written (what technology, which Oracle access API). For example, for SQL*Plus, the NLS_LANG must be set to AR8MSWIN1256, as SQL*Plus does not support Unicode on Windows, only the ANSI code page. For SQL Developer, the NLS_LANG does not matter at all.
    -- Sergiusz

  • Character set on windows

    Hello All,
    Please i need help on how to confirm the character set on windows. i have tried going through registry >HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\NLS\CodePage\ ( nothing like ACP here)
    Under code page i have the following:
    EUDCCodeRange
    Language
    Language Groups
    from command prompt if i run:
    H:\>chcp
    Active code page: 437
    Please what character set is ACP 437 equivalent to?
    Response required urgently#
    Thanks

    We have noticed that the application is not interpreting the request strings in the correct character encoding. Can you be a bit more specific? What problem, exactly, are you having?
    So please how do i confirm if i am on WE8ISO8859P1 or WE8MSWIN1252' on the client side(windows)Are you asking what the NLS_LANG should be for Windows? Or for command-line DOS? Or something else?
    In the same NLS_LANG FAQ I linked to earlier, there is a section on [configuring NLS_LANG for Windows and DOS|http://www.oracle.com/technology/tech/globalization/htdocs/nls_lang%20faq.htm#_Toc110410552]. I don't believe that it is possible for a Windows GUI to be using the ISO 8859-1 character set.
    Browse the following registry entry:
    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\NLS\CodePage\
    There you have (all the way down) an entry with as name ACP. The value of ACP is your current GUI Codepage, for the mapping to the Oracle name. Since there are many registry entries with very similar names, please make sure that you are looking at the right place in the registry.Justin

  • I'm a brand new Mac user. I want to send photos from Iphoto to my local store for printing, like I can do in Picasa. I can't find that option in Iphoto.

    I'm a brand new Mac user. I want to send photos from Iphoto to my local store for printing, like I can do in Picasa. I can't find that option in Iphoto. I do not want to order them through Itunes.

    I have not idea how you do it with Picasa but with iPhoto you either export the photos to a desktop folder and upload from there or burns that folder to CD - or from the upload window use the media browser in the lower left hand corner of the upload windows - media ==> photos ==> iPhoto
    For pictures see -  https://discussions.apple.com/thread/3547767?tstart=0
    LN

  • Accessing Windows XP "Regional Options"

    In the Windows XP control panel, I can set the "Regional Options" for my computer. For example, the currency format looks like this: "$123,456,789.00" and the time format like this: "16:10:51".
    Is there an API that allows me to access these formats from within Java, and can notify me when they change?

    Is there any native API such as C/C++ that we
    can call and then we can in turn write our own JNI
    interface to connect to it.Clearly there is, because many of the Windows programs I use every day display dates in the format I specified in the Regional Settings.
    Do I know what it is? No. But this isn't the best place to look for that information. MSDN is the best place.

  • Regional and Language Settings for Window and BEX Style

    Hi All,
    When I change the Regional and Language Settings for Windows, Standards and Formats value to English (USA) the standard Style for BEX is active. For instance, input-ready cell is bordered with blue. But when I switch to Turkish this style is not active.
    Additionally, I have to change Style for each Workbook one by one. How can we adopt a style to every workbook.
    Regards,

    Lars,
    This is a setting on the 'Defaults' tab in the User Profile. This can be set when a new user is set-up in SU01, or it can be changed by each user according to personal preference in SU3. I'm sure there is a system table where these settings are stored that could probably be edited for all users, if that is desired, but I don't know which table that would be off the top of my head.
    Hope this helps...
    Bob

  • JDK1.3: Regional Options

    Hi,
    I'm using Win2000 Prof platform for development. The Locale and Language in "Regional Options" were set to "Typical Chinese (Hong Kong)". When I use JDK1.3 to compile my Java programs, strange symbols and Chinese will be displayed if any output messages (e.g. error messages) are generated by the compiler. I would like to have English display instead of Chinese and those strange symbols, but I don't want to set the locale and language for Win2000 to English. Could anyone give your advices? Thanks in advance!
    P.S.: No such display problem when I used JDK1.2.

    I am having the same problem on my Japanese Windows 2000 professional using Java 1.4.2_01. Did you find a solution?

  • Windows 2012 Verification of prerequisites for Domain Controller promotion failed

    Windows 2012 Verification of prerequisites for Domain Controller promotion failed and gave the below error(In computer management local group and user option is not there as suggested by a solution!)
    "Verification of prerequisites for Domain Controller promotion failed. The local Administrator account becomes the domain Administrator account when you create a new domain. The new domain cannot be created because the local Administrator account password
    does not meet requirements.
    Currently, the local Administrator password is blank, which might lead to security issues. We recommend that you press Ctrl+Alt+Delete, use the net user command-line tool, or use Local Users and Groups to set a strong password for the local Administrator
    account before you create the new domain."

    OK, the reason you see this error is because when you set up and configured your Windows R2 environment you may have logged into the OS with an account other than Administrator. So, if you created your log in account named Bob, this is throwing off the Server.
    So, hit Ctrl-Alt-Delete, and look who you are logged in as, and then change the account you are logging in as and use the local Administrator account. What you may find is that the default Admin account password has not been set.
    Check that out and see if that is what you are experiencing.
    Best wishes

  • Enabling "Windows activation" option in the "Change Action Center settings" window

    Hi
    I activated Windows 8.1 Update Enterprise 64-bit.
    I noticed, however, that, in the "Change Action Center settings" window, the "Windows Activation" option is disabled and picked. How come? How do I enable and unpick it?
    Thanks
    Bye
    Balubeto

    1. What is output of command
    slmgr /dlv
    2. Contact local administrator for help (Enterprise is multilicense and some help is prepaid. If local admin has no solution, he or she can escalate problem.) You have not given more information on infrastructure configuration (KMS ?).
    Rgds
    Milos

  • ACE default handling of the TCP Window Scale option

    Can someone tell me a reasonable explanation why the default action of the ACE is to clear the window-scale option in SYN-segments? We were long baffled why some customers (specifically the ones with larger latencies) were suffering from poor TCP transfer speeds and resets. Packet captures confirmed the fact that the ACE was clearing window-scale options, causing the advertised receive windows to be remarkably small as the scaling factors were removed.
    Isn't intermediate tampering with the window-scale option a widely known source for TCP performance problems? Window scaling is after all a widely used TCP extension. That's why I'm curious to know why such default behaviour from the ACE.
    Our problem was of course finally resolved by explicitly allowing the window-scale option using a parameter map.

    HI Timo,
    As you know if you allows the ACE to use a window scale factor that essentially increases the size of the TCP send and receive buffers. The sender specifies a window scale factor in a SYN segment that determines the send and receive window size for the duration of the connection.
    You have defined tcp-options scale allow in the parameter map but have not specified to which scale factor this should scale to.
    The TCP window scaling feature adds support for the Window Scaling option in RFC 1323. It is recommend that increasing the window size to improve TCP performance in network paths with large bandwidth, long-delay characteristics. This type of network is called a long fat network (LFN).
    But you have not configure a TCP window-scale factor which is essential for network paths with high-bandwidth, long-delay characteristics, using the "set tcp window-scale " command.
    The window scaling extension expands the definition of the TCP window to 32 bits and then uses a scale factor to carry this 32-bit value in the 16-bit window field of the TCP header.
    You can increase the window size to a maximum scale factor of 14.
    Typical applications use a scale factor of 3 when deployed in LFNs but in you case if this is a LFN you are using default which is 0.
    So here in your case you can select how much scale factor is needed to be defined from the range 0-14 , otherwise even if you have defined in the tcp-options windlow-scale allow, but as you have not define to what factor it should scale to , so it will always use the default scale factor which is 0, means no scaling at all.
    To set the TCP window-scale factor to 3, add the second command as well in your parameter map:
    host1/Admin(config-parammap-conn)# tcp-options window-scale allow        ---> Defined already
    host1/Admin(config-parammap-conn)# set tcp window-scale 3                      ----> Needed to be added else "default scale factor 0" will be taken
    You can check in the following URL at cisco docs wiki for how ACE handles Connection at Layer 4 (L4) and Layer 7 (L7):
    http://docwiki.cisco.com/wiki/Cisco_Application_Control_Engine_(ACE)_Module_Troubleshooting_Guide,_Release_A2(x)_--_Troubleshooting_Connectivity
    Here are the details of how a tcp-options scale windows works:
    The window scale extension expands the definition of the TCP
    window to 32 bits and then uses a scale factor to carry this 32- bit
    value in the 16-bit Window field of the TCP header (SEG.WND in RFC-793).
    The scale factor is carried in a new TCP option, Window Scale.
    This option is sent only in a SYN segment (a segment with the SYN bit on),
    hence the window scale is fixed in each direction when a connection is opened.
    (Another design choice would be to specify the window scale in every TCP segment.
    It would be incorrect to send a window scale option only when the scale factor changed,
    since a TCP option in an acknowledgement segment will not be delivered reliably
    (unless the ACK happens to be piggy-backed on data in the other direction).
    Fixing the scale when the connection is opened has the advantage of lower
    overhead but the disadvantage that the scale factor cannot be changed
    during the connection.) The maximum receive window, and therefore the
    scale factor, is determined by the maximum receive buffer space.
    In a typical modern implementation, this maximum buffer space is set
    by default but can be overridden by a user program before a
    TCP connection is opened. This determines the scale factor,
    and therefore no new user interface is needed for window scaling.
    Window Scale Option The three-byte Window Scale option
    may be sent in a SYN segment by a TCP.
    It has two purposes:
    (1) indicate that the TCP is prepared to do both send and receive window scaling, and
    (2) communicate a scale factor to be applied to its receive window.
    Thus, a TCP that is prepared to scale windows should send the option,
    even if its own scale factor is 1. The scale factor is limited to
    a power of two and encoded logarithmically,
    so it may be implemented by binary shift operations.
    TCP Window Scale Option (WSopt):
    Kind: 3 Length: 3 bytes
    +---------+---------+---------+
    | Kind=3 |Length=3 |shift.cnt|
    +---------+---------+---------+
    This option is an offer, not a promise; both sides must send
    Window Scale options in their SYN segments to enable window
    scaling in either direction. If window scaling is enabled,
    then the TCP that sent this option will right-shift its true
    receive-window values by 'shift.cnt' bits for transmission in
    SEG.WND. The value 'shift.cnt' may be zero (offering to scale,
    while applying a scale factor of 1 to the receive window).
    This option may be sent in an initial segment (i.e., a
    segment with the SYN bit on and the ACK bit off).
    It may also be sent in a segment, but only if a Window
    Scale op- tion was received in the initial segment.
    A Window Scale option in a segment without a SYN bit should be ignored.
    The Window field in a SYN (i.e., a or ) segment itself is never scaled.
    Using the Window Scale Option
    A model implementation of window scaling is as follows
    All windows are treated as 32-bit quantities for storage in
    the connection control block and for local calculations.
    This includes the send-window (SND.WND) and the receive- window
    (RCV.WND) values, as well as the congestion window.
    * The connection state is augmented by two window shift counts,
    Snd.Wind.Scale and Rcv.Wind.Scale, to be applied to the
    incoming and outgoing window fields, respectively.
    * If a TCP receives a segment containing a Window Scale
    option, it sends its own Window Scale option in the segment.
    * The Window Scale option is sent with shift.cnt = R, where R
    is the value that the TCP would like to use for its receive window.
    * Upon receiving a SYN segment with a Window Scale option containing
    shift.cnt = S, a TCP sets Snd.Wind.Scale to S and sets Rcv.Wind.Scale
    to R; otherwise, it sets both Snd.Wind.Scale and Rcv.Wind.Scale to zero.
    * The window field (SEG.WND) in the header of every incoming segment,
    with the exception of SYN segments, is left-shifted by Snd.Wind.Scale
    bits before updating SND.WND: SND.WND = SEG.WND << Snd.Wind.Scale
    (assuming the other conditions of RFC793 are met,
    and using the "C" notation "<<" for left-shift).
    * The window field (SEG.WND) of every outgoing segment, with the
    exception of SYN segments, is right-shifted by
    Rcv.Wind.Scale bits: SEG.WND = RCV.WND >> Rcv.Wind.Scale.
    TCP determines if a data segment is "old" or "new" by testing
    whether its sequence number is within 2**31 bytes of the left
    edge of the window, and if it is not, discarding the data as "old".
    To insure that new data is never mistakenly considered old and vice- versa,
    the left edge of the sender's window has to be at most 2**31 away
    from the right edge of the receiver's window. Similarly with the
    sender's right edge and receiver's left edge. Since the right and
    left edges of either the sender's or receiver's window differ by
    the window size, and since the sender and receiver windows can be
    out of phase by at most the window size, the above constraints imply
    that
    2 * the max window size must be less than 2**31,
    or max window < 2**30 Since the max window is 2**S
    (where S is the scaling shift count) times at most 2**16 - 1
    (the maximum unscaled window),
    the maximum window is guaranteed to be < 2*30 if S <= 14.
    Thus, the shift count must be limited to 14 (which allows windows of 2**30 = 1 Gbyte).
    If a Window Scale option is received with a shift.cnt value exceeding 14,
    the TCP should log the error but use 14 instead of the specified value.
    The scale factor applies only to the Window field as transmitted
    in the TCP header; each TCP using extended windows will maintain
    the window values locally as 32-bit numbers. For example,
    the "congestion window" computed by Slow Start and Congestion Avoidance
    is not affected by the scale factor, so window scaling will not introduce
    quantization into the congestion window.
    Hope it will resolve your issue, else get back to us for further discussion.
    Best regards,
    Sachin Garg
    Message was edited by: sachinga.hcl

  • Making use of local DNS for home network

    I have an Apple Base Station and I wish to set up better local services on my home network, starting with local DNS. I see that the ABS will attempt to apply the <name>.local handle for devices but this seems inconsistent. What defines whether a host/file-server/printer/etc... will get a name and how is is defined? For windows machines, do I need Bonjour installed for this to work or will it take info from WINS or NETBIOS? For machines with DHCP addresses is there a way to set up some sort of dynamic DNS or bind a name to the devices MAC address?

    Hi and welcome to the forum.
    The actual Home highway box (with the telephone sockets and blue cat 5 sockets on the front) I would suggest you just throw in the bin.
    You would also have had a special front plate installed that plugs into the BT owned NTE5.
    Not sure what you had in mind, do you want to have a new line provided or shift your existing line over to the old socket?
    (If I have helped you in any way to say "Thank You" please click on the star next to the message. Thank You)
    If I have solved your Issue please click the "Mark as accepted solution" button.

  • When I don't have the BROWSER menu option turned on, the WINDOW menu options are un-accessable by mouse

    First of all, I would like to clarify which "menu" is un-accessable.
    I'm referring to the menu that regardless of which program, a user can access by either clicking ALT + SPACE or by clicking the top left corner of the window. I'm NOT referring to the FIREFOX menu options, those I am fine with.
    Normally, I can just move my mouse to the top left corner and double click to close a program. I used to be able to do that too with firefox 3.6. However, due to the new design, when I click the top left corner, I get the orange Firefox drop down menu. This is because firefox, due to the new update, no longer has an independent window bar that is the norm across most programs. The only way I can get this independent menu bar is to enable the browser menu bar. This however, adds two entire layers of bars, which defeats one of the purposes of the update, to give more viewing space
    The Chrome browser also has the tab row on top, however, it doesn't have the issue I brought up. When I click the top left corner of the window, the regular WINDOW menu options pop up.
    The reason why this is important to me is due to the fact that I use two monitors. Normally, I can just move my cursor to the top right and close the window without looking for my right hand side monitor, and then double click the top left hand side of my left hand side monitor to close the window. This is because with a 2 monitor set up, the "X" close button is located inconvinently in the middle of my two screens, forcing me to aim for the tiny small red rectangle, which is why I prefere to double click the top left corner; I don't have to aim.
    I have long been a loyal user of firefox. Browsers like Chrome and others have been out ranking firefox for a long time, mozilla is only playing catch up here...
    While I am glad for the update - better speed due to JaegerMonkey, the added hardware acceleration, the tab groups, and more, if the window menu problem is not resolved soon, this update is going to force me to switch browsers.
    I look forward to a fix, or response on how to resolve this issue.
    Many thanks,
    Still a firefox user... for now

    it's possible but there is likely no need to do this. what exactly is wrong with your computer? a simple reinstall of snow leopard on top of your current system will cure many ills and will preserve your data and applications. and many problems can be solved without reinstalling at all.
    but if you insist on doing a wipe and install boot from the SL install DVD and start disk utility from utilities menu at the top. erase your hard drive using the erase tab in disk utility. then quit disk utility and proceed with the install. and if you do reinstall I suggest you back up your data first. otherwise it will be completely wiped when you erase your hard drive. and you should always back up anyway.
    Message was edited by: V.K.

Maybe you are looking for