What's the difference of character encoding between 1.4.0and1.4.2 in Linux

As i find, the character encoding about chinese in jdk1.4.2 no langer the same of jdk1.4.0.
In jdk1.4.0, the character encoding used the "file.encoding" system property, we often set the
property with "gb2312".
But in jdk1.4.2, i find that the default character encoding no longer used the "file.encoding" system property.
Who knows the reason?
Test Program:
public class B{
public static void main(String args[]) throws Exception{
byte [] bytes = new byte[]{(byte)0xD6,(byte)0xD0,(byte)0xCE,(byte)0xC4};
String s1 = new String(bytes);
String s2 = new String(bytes,System.getProperty("file.encoding"));
System.out.println("s1="+s1+" , s2="+s2);
System.out.println("s1.length=" + s1.length() + " , s2.length="+s2.length());
run four times and the result list:
[root@app15 component]# /usr/local/j2sdk1.4.0/bin/java -Dfile.encoding=ISO-8859-1 -cp . B
s1=中文 , s2=中文
s1.length=4 , s2.length=4
[root@app15 component]# /usr/local/j2sdk1.4.0/bin/java -Dfile.encoding=gb2312 -cp . B
s1=中文 , s2=中文
s1.length=2 , s2.length=2
[root@app15 component]# /usr/local/j2sdk1.4.2/bin/java -Dfile.encoding=ISO-8859-1 -cp . B
s1=中文 , s2=中文
s1.length=4 , s2.length=4
[root@app15 component]# /usr/local/j2sdk1.4.2/bin/java -Dfile.encoding=gb2312 -cp . B
s1=中文 , s2=??
s1.length=4 , s2.length=2
[root@app15 component]#

I don't know for sure, but:
-- The API documentation for String says that "new String(byte[])" uses "the platform's default charset".
-- The API documentation for Charset says "The default charset is determined during virtual-machine startup and typically depends upon the locale and charset being used by the underlying operating system."
You'll notice that it doesn't say anything about using the file.encoding system value, so presumably (based on your experiments) it doesn't. I did a search for "java default charset" and didn't find anything specific, but this site says "As of Java 1.4.1, the default Charset varies from platform to platform" and suggests you explicitly hard-code your charset. I would agree with that.

Similar Messages

  • What is the difference in execution time between a program written in C language and the same program made with LabView?

    what is the difference in execution time between a program written in C language and the same program made with LabView?

    Hi Pepe
    You cannot say which is faster, the LV or the C programm. The only way to be sure is to program in both environments and to check than. Check this for some benchmark examples:
    http://zone.ni.com/devzone/conceptd.nsf/webmain/DC9B6DD177D91D6286256C9400733D7F?OpenDocument&node=200059
    Luca
    Regards,
    Luca

  • What is the difference in PS E12 between 'File Open' and 'File Open in Camera Raw' ?

    Both routes launch a screen saying Camera Raw 8.3 - Canon EOS 5D Mark III?
    Likewise on this screen there is 'Cancel' and 'Done' Buttons', what is the difference both close that screen.
    I am assuming the 'Done' Buttons saves any manipulation of exposure or colours you may have made? and the 'Cancel' just forgets them?
    Is there a manual for this product; that one can reference, screen by screen? explaining what each option actually does.

    Chucky-Tiger wrote:
    Both routes launch a screen saying Camera Raw 8.3 - Canon EOS 5D Mark III?
    If you are opening a raw file (.CR2), both routes are identical, because you have to convert raw files in ACR anyway.
    If you are opening a jpeg file, you can open the file directly in the Elements Editor (Open),
    or
    you can open it the the ACR module. The dialog is the same (or nearly) as for raw files, with the same sliders and features, including some you don't find in the editor : clarity, advanced denoising...
    There are advantages in opening jpegs in ACR, especially because ACR works internally in 16 bits and in a wider color gamut. Very important for me is the fact that the ACR modules saves its edits as 'recipees' in the metadata section of the jpeg files, without changing any pixel value of the original.
    Likewise on this screen there is 'Cancel' and 'Done' Buttons', what is the difference both close that screen.
    I am assuming the 'Done' Buttons saves any manipulation of exposure or colours you may have made? and the 'Cancel' just forgets them?
    Cancel does cancel every edit you have started. You are back to the original file.
    'Done' saves your edits, as you rightly assume.
    'Open' saves the edits and send them to the editor for further editing if you want, for local retouch or using layers for instance.
    'Alt Open' does not saves the edits, but sends the edited result to the editor.
    'Save' is only used if you wish to convert the raw files to the DNG format.

  • HT5234 Is there something additional I should know other than what I already figure here re: What is the difference and/or benefit between the two power adapters (one with AC cord, one without) that come with the MacBook Air 11"? TY

    As per question, TY.

    One is longer and one is shorter. Depending on your location one may have a grounding port whereas the other doesn't. Otherwise no real difference.

  • What is the difference aside from size between the 15 and 17 inch MBP

    im trying to decide which one to get. money is not the issue here. I do need to carry on the laptop in my camera bag worldwide. I want the fastest most adept laptop. Photoshop ( when they offer the new version ) and garageband must run very smoothly. Will the 17" run that better than the 15" or is this just about a bigger screen?
    anyone have experience with both?
    own both?
    thanks

    it's really just the screen, a couple of extra ports and the availability of a 7200rpm drive as a custom build, if this appeals to you. that's it.

  • What's the difference between Generators and Image Units?

    Hi
    What's the difference (in layman terms) between the Generators and Image Units in the Library?

    I may be wrong, but I believe that Image Units are part of the operating system (core video, core gfx, etc), thus can change with OS changes. Generators and filters are coded specific to Motion...
    Patrick

  • What 's the difference between quote ' and double quote "?

    what's the difference between quote' and double quote "?
    when we use each one?
    Exemple of use of each case?

    'c' is a char, ie. a primitive type representing a single character
    "c" is an instance of the String class length 1.

  • What Is The Difference Between Save As Self-Contained Movie and Exporting

    What Is The Difference Between Save As Self-Contained Movie and Exporting a Video as a Quicktime File

    Save As places the file inside a .mov container. No re-encoding.
    Your still have the option to save this file as "self-contained" (all the parts travel with the file) or "reference" (small file sized movie that merely "points" to the movie parts).
    A reference movie can't play if the source files can't be found. If they are moved or deleted the reference movie will fail and it can't be re-created.
    Exporting is done to convert one QuickTime format to another. Typically you do this with a high quality source file. Exporting previously compressed files is a bad idea that leads to unpredictable results.
    QuickTime doesn't open WMP formats without third party software help (Flip4Mac is one). You can't convert (export) WMP formats without paying extra fees to upgrade their software.

  • What is the difference between DSo and Infocube

    Hello,
             Kindly tell me what is the difference between DSO and Infocube?
    And please tell me how to take the desicion that in whichi case we can use DSO and in which case we can use Infocube..

    Hi ,
    DataStore object serves as a storage location for consolidated and cleansed transaction data or master data on a document (atomic) level.
    This data can be evaluated using a BEx query.
    A DataStore object contains key fields (for example, document number/item) and data fields that can also contain character fields (for example, order status, customer) as key figures. The data from a DataStore object can be updated with a delta update into InfoCubes and/or other DataStore objects or master data tables (attributes or texts) in the same system or across different systems.
    Unlike multidimensional data storage using InfoCubes, the data in DataStore objects is stored in transparent, flat database tables. The system does not create fact tables or dimension tables.
    Use
    The cumulative update of key figures is supported for DataStore objects, just as it is with InfoCubes, but with DataStore objects it is also possible to overwrite data fields. This is particularly important with document-related structures. If documents are changed in the source system, these changes include both numeric fields, such as the order quantity, and non-numeric fields, such as the ship-to party, status and delivery date. To reproduce these changes in the DataStore objects in the BI system, you have to overwrite the relevant fields in the DataStore objects and set them to the current value. Furthermore, you can use an overwrite and the existing change log to render a source delta enabled. This means that the delta that is further updated to the InfoCubes, for example, is calculated from two successive after-images.
    An InfoCube describes (from an analysis point of view) a self-contained dataset, for example, for a business-orientated area. You analyze this dataset in a BEx query.
    An InfoCube is a set of relational tables arranged according to the star schema: A large fact table in the middle surrounded by several dimension tables.
    Use
    InfoCubes are filled with data from one or more InfoSources or other InfoProviders. They are available as InfoProviders for analysis and reporting purposes.
    Structure
    The data is stored physically in an InfoCube. It consists of a number of InfoObjects that are filled with data from staging. It has the structure of a star schema.
    The real-time characteristic can be assigned to an InfoCube. Real-time InfoCubes are used differently to standard InfoCubes.
    ODS versus Info-cubes in a typical project scenario
    ODS
    why we use ods?
    why is psa  & ods nessasary
    Hope this helps,
    Regards,
    CSM Reddy

  • What is the difference between Planning cycle and Delivery cycle?

    Hi gurus ,
    After created the planning calendar for store ,  I have the same option value for planning cycle and delivery cycle (planning calendar) in the MRP area data for site specific material master , so what's the difference between these two field ?
    Thanks in advance ,
    Ryan

    Hi,
    If you have to deal with more complex situations, you can define a delivery cycle in the material master record in addition to the planning cycle. In so doing, you determine the days on whichthe vendor delivers his goods. The delivery cycle is entered in the material master record as a planning calendar in the Planning calendar field.
    You enter a delivery cycle if the delivery date (or the goods receipt date) depends on the day on which you order the goods. For example, you carry out the planning run and place your orders on Mondays and Tuesdays. If you place the order on Monday, the delivery is made on Wednesday, if you wait until Tuesday to place the order, the delivery is not made until Friday
    Where as Planning calander is Three character number (numeric or using letters) that specifically identifies a PPS-planning calendar. The difference between Planning calender and delivery cycle is If you have selected the MRP type "MRP" and have set a period lot-sizing procedure according to planning calendar, you enter here which planning calendar is to be used.
    If you selected the "time-phased planning" MRP type, the planning calendar that you specify here defines the delivery cycle. This specifies the days on which the vendor delivers the material. You can enter the planning cycle in addition to the delivery cycle

  • What is the difference between OCIEnvCreate and OCIEnvNlsCreate with utf16

    because i find a oci sample code cdemouni.c,in this sample,use OCIEnvCreate with mode set OCI_UTF16,but OCIEnvNlsCreate also can set charset and ncharset OCI_UTF16ID,what is the difference between OCIEnvCreate and OCIEnvNlsCreate with UTF16?

    First, OCIEnvNlsCreate() is recommended way of switching to UTF-16 mode.
    Second, OCIEnvNlsCreate() uses new semantics for bind and define buffer lengths. With new semantics all lengths are in bytes. With old semantics,
    UTF-16 string lengths are in codepoints, while other character sets use bytes.
    You can get new length semantics with OCIEnvCreate() as well, by
    adding OCI_NEW_LENGTH_SEMANTICS to the 'mode' flags.
    -- Sergiusz

  • What is the difference between OCIEnvCreate and OCIEnvNlsCreate?

    because i find a oci sample code cdemouni.c,in this sample,use OCIEnvCreate with mode set OCI_UTF16,but OCIEnvNlsCreate also can set charset and ncharset OCI_UTF16ID,what is the difference between OCIEnvCreate and OCIEnvNlsCreate with UTF16?

    First, OCIEnvNlsCreate() is recommended way of switching to UTF-16 mode.
    Second, OCIEnvNlsCreate() uses new semantics for bind and define buffer lengths. With new semantics all lengths are in bytes. With old semantics,
    UTF-16 string lengths are in codepoints, while other character sets use bytes.
    You can get new length semantics with OCIEnvCreate() as well, by
    adding OCI_NEW_LENGTH_SEMANTICS to the 'mode' flags.
    -- Sergiusz

  • What is the difference between customer exits and user exits?

    hello friends,
    what is the difference between customer exits and user exits?

    Hi
    User exit - A user exit is a three character code that instructs the system to access a program during system processing.
    SXX: S is for standard exits that are delivered by SAP.   XX represents the 2-digit exit number.
    UXX: U is for user exits that are defined by the user.  XX represents the 2-digit exit number
    Customer exit - The R/3 enhancement concept allows you to add your own functionality to SAP’s standard business applications without having to modify the original applications. SAP creates customer exits for specific programs, screens, and menus within standard R/3 applications. These exits do not contain any functionality. Instead, the customer exits act as hooks. You can hang your own add-on functionality onto these hooks.     *-- Mani
    The following document is about exits in SAP :-
    The R/3 enhancement concept allows you to add your own functionality to SAP’s standard business applications without having to modify the original applications. 
    SAP creates user exits for specific programs, screens, and menus within standard R/3 applications. These exits do not contain any functionality. Instead, the customer exits act as hooks. You can hang your own add-on functionality onto these hooks.
    Types of Exits 
    There are several different types of user exits. Each of these exits acts as hooks where you can attach or "hang" your own add-ons.
    Menu Exits
    Menu exits add items to the pulldown menus in standard SAP applications. You can use these menu items to call up your own screens or to trigger entire add-on applications.
    SAP creates menu exits by defining special menu items in the Menu Painter. These special entries have function codes that begin with "+" (a plus sign). You specify the menu item’s text when activating the item in an add-on project.
    Screen Exits
    Screen exits add fields to screens in R/3 applications. SAP creates screen exits by placing special subscreen areas on a standard R/3 screen and calling a customer subscreen from the standard screen’s flow logic.
    Function Module Exits 
    Function module exits add functions to R/3 applications. Function module exits play a role in both menu and screen exits. 
    When you add a new menu item to a standard pull down menu, you use a function module exit to define the actions that should take place once your menu is activated. 
    Function module exits also control the data flow between standard programs and screen exit fields. SAP application developers create function module exits by writing calls to customer functions into the source code of standard R/3 programs. 
    These calls have the following syntax: 
    CALL CUSTOMER-FUNCTION ‘001’.
    Field Exits
    Field exits allow you to create your own programming logic for any data element in the Dictionary. You can use this logic to carry out checks, conversions, or business-related processing for any screen field.  Example: The data element BBBNR identifies a company’s international location number. You might want to set up your R/3 System so that all international location numbers are larger than 100. 
    The field exit concept lets you create a special function module that contains this logic. 
    You assign the special function module to the data element BBBNR. You then assign the module to any programs and screens in which users can add new international location numbers. When you activate your field exit, the system automatically triggers your special routine whenever a user enters a company location number. 
    In 4.6c, you can use "RSMODPRF" program to create field exits.
    An example of a user exits :-
    MODULE user_exit_0001 INPUT 
        CASE okcode.
            WHEN 'BACK OR EXIT'.
                CASE sy-dynnr.
                        WHEN '100'.
                             SET SCREEN 0.
                             LEAVE SCREEN.
                        WHEN '200'.
                             SET SCREEN 100.
                             LEAVE SCREEN.
                 ENDCASE.
          ENDCASE.

  • What is the difference between Planning calendar and Delivery cycle?

    Hi gurus ,
    For the Planning calendar(MARC-LFRHY) and Delivery cycle(MARC-MRPPP), what is the difference between their functionality ?
    I have created the planning calendar by MD25 ,and when I maintain this field in the MRP screen , i found the delivery cycle have the same choose value , so could you make me clear about this ?
    Thanks in advance .
    Ryan

    Hi,
    If you have to deal with more complex situations, you can define a delivery cycle in the material master record in addition to the planning cycle. In so doing, you determine the days on whichthe vendor delivers his goods. The delivery cycle is entered in the material master record as a planning calendar in the Planning calendar field.
    You enter a delivery cycle if the delivery date (or the goods receipt date) depends on the day on which you order the goods. For example, you carry out the planning run and place your orders on Mondays and Tuesdays. If you place the order on Monday, the delivery is made on Wednesday, if you wait until Tuesday to place the order, the delivery is not made until Friday
    Where as Planning calander is Three character number (numeric or using letters) that specifically identifies a PPS-planning calendar. The difference between Planning calender and delivery cycle is If you have selected the MRP type "MRP" and have set a period lot-sizing procedure according to planning calendar, you enter here which planning calendar is to be used.
    If you selected the "time-phased planning" MRP type, the planning calendar that you specify here defines the delivery cycle. This specifies the days on which the vendor delivers the material. You can enter the planning cycle in addition to the delivery cycle

  • What is the difference between MOVE var1 TO var2 and var2 = var1? Help!

    Hi Experts,
        What is the difference between MOVE var1 TO var2 and var2 = var1?
    Thanks
    Gopal

    Gopal,
      pls. look into it.Good explanation on you requirement.
    To assign the value of a data object <f1> to a variable <f2>, use the following statement:
    MOVE <f1> TO <f2>.
    or the equivalent statement
    <f2> = <f1>.
    The contents of <f1> remain unchanged. <f1> does not have to be a variable - it can also be a literal, a text symbol, or a constant. You must always specify decimal points with a period (.), regardless of the user’s personal settings.
    Multiple value assignments in the form
    <f4> = <f3> = <f2> = <f1>.
    are also possible. ABAP processes them from right to left as follows:
    MOVE <f1> TO <f2>.
    MOVE <f2> TO <f3>.
    MOVE <f3> TO <f4>.
    In the MOVE statement (or when you assign one value to another with the equal sign), it is not possible to specify the field names dynamically as the contents of other fields. If you need to do this, you must use field symbols .
    There are three possible outcomes of assigning <f1> to <f2>:
    The data objects <f1> and <f2> are fully compatible, that is, their data types, field length, and number of decimal places are identical. The contents of source field <f1> are transferred byte by byte into the target field <f2> without any further manipulation. The MOVE statement is most efficient when this is the case.
    The data objects <f1> and <f2> are incompatible. This is the case, for example, if the two fields have the same type, but different lengths. The contents of the source field <f1> are converted so that they are compatible with the data type of <f2>, and are then transferred. This procedure only works if a conversion rule exists between the data types of <f1> and <f2>. Type conversions make the MOVE statement less efficient. How much less efficient depends on the individual conversion.
    The data objects <f1> and <f2> are incompatible, and no conversion is possible. The assignment is not possible. If this can be recognized statically, a syntax error occurs. If it is not recognized before the program is run, a runtime error occurs.
    The source and target fields can be of different data types. In contrast to other programming languages, where the assignment between different data types is often restricted to a small number of possible combinations, ABAP provides a wide range of automatic type conversions.
    For example, the contents of a source field with an elementary data type can be assigned to a target field with any other data type. The single exception to this rule is that it is not possible to assign values between type D fields and type T fields. ABAP even supports assignments between a structure and an elementary field, or between two structures.
    DATA: T(10) TYPE C,
          NUMBER TYPE P DECIMALS 2,
          COUNT  TYPE I.
    T = 1111.
    MOVE '5.75' TO NUMBER.
    COUNT = NUMBER.
    Following these assignments, the fields T, NUMBER, and COUNT have the values ‘1111      ’, 5.75, and 6 respectively. When you assign the number literal 1111 to T, it is converted into a character field with length 10. When you assign NUMBER to COUNT, the decimal number is rounded to an integer (as long as the program attribute Fixed pt. arithmetic has been set).
    Pls. reward if useful

Maybe you are looking for