read the unicode character value

Hi all

I'm reading a file that is written in albanin. So of course, I've implemented a way to read in unicode and then store then in an Arraylist and print again return.

Here is the code I tried:

FileInputStream
Dim str As String = null;
Try
{
in = new FileInputStream ("C:\\Users\\Administrator\\Desktop\\d1.txt");
InputStreamReader inputStreamReader = new InputStreamReader (in);
BufferedReader bufferedReader = new BufferedReader (inputStreamReader);

Str = bufferedReader.readLine ();
}
catch (System.Exception e)
{
e.printStackTrace ();
}

StringBuffer ostr = new StringBuffer();

for (int i = 0; i < str.length (); i ++)
{


OSTR. Append ("\\u");
Hex String = Integer.toHexString (str.charAt (i) & 0xFFFF); Get a hex value of Arctic char.

for (int j = 0; j < 4 - hex.length (); j ++) / / Prepend zeros because unicode requires 4 numbers
OSTR. Append ("0");
OSTR. Append (hex.toLowerCase ()); format of the unicode standard.

}

System.out.println (new String (ostr));




Although the unicode letter 'Ë' is 00cb, program gives the value "\ufffd" but for other normal characters, it displays the correct values (for English characters)


How can I solve this problem?


Thanks in advance...

first of all, check your encoding of the file.

Tags: Java

Similar Questions

  • Unable to read the list of values of FRM-40502

    Hi all

    Unable to read the list of values of FRM-40502

    get this error when I try to fill the list of values for some employees

    Here's the LOV query
    Select dsm_code,dsm_desc,dsm_content from deschange_master
    where dsm_orgn=:parameter.p_orgn
    and (dsm_ctry =:parameter.p_ctry or :parameter.p_ctry is null)
    and(dsm_loc =:parameter.p_loc or :parameter.p_loc is null)
    and( dsm_oru =:parameter.p_oru or :parameter.p_oru is null)
    and
    ((DSM_CODE  like '%PWI%' and DSM_CODE like '%INCR%')
    and (select count(eih_emp_code)from employee_increment_header
    where eih_emp_code =:edcd_emp_code and
    to_date(eih_eff_date,'DD-MON-RR') = to_date(:desig_date,'DD-MON-RR'))=1)
    or
    ((DSM_CODE not like '%PWI%' and DSM_CODE not like '%INCR%')
    and (select count(eih_emp_code)from employee_increment_header
    where eih_emp_code = :edcd_emp_code and
    to_date(eih_eff_date,'DD-MON-RR') = to_date(:desig_date,'DD-MON-RR'))<>1)
    order by dsm_code

    Hello
    Try

    Select dsm_code,dsm_desc,dsm_content from deschange_master
    where dsm_orgn=:parameter.p_orgn
    and (dsm_ctry =:parameter.p_ctry or :parameter.p_ctry is null)
    and(dsm_loc =:parameter.p_loc or :parameter.p_loc is null)
    and( dsm_oru =:parameter.p_oru or :parameter.p_oru is null)
    and
    (((DSM_CODE  like '%PWI%' or DSM_CODE  like '%INCR%')
    and (select count(eih_emp_code)from employee_increment_header
    where eih_emp_code = :EDCD_EMP_CODE and
    eih_eff_date = to_date(:DESIG_DATE))=1)
    or
    ((DSM_CODE not like '%PWI%' and DSM_CODE not like '%INCR%')
    and (select count(eih_emp_code)from employee_increment_header
    where eih_emp_code = :EDCD_EMP_CODE and
    eih_eff_date = to_date(:DESIG_DATE))!=1))
    

    Thank you

  • read the first character of each line

    Hello!

    I have a problem with the reading of a text file in LabView which I think is pretty easy to do, but since I'm really new to labview (and programming at all) I'm having a hard time to understand.

    So basically, I use the VI 'write file to measure' to write some test results to a text file. I'm just the ones and zeros so the text file looks something like this:

    1.00000

    0.00000

    1.00000

    ..

    and so on.

    I would then import these values in labview but I don't want decimals and I would like that everything on the same line, something like this:

    1 0 1 0 etc etc.

    (the idea is to then be able to convert the values to a hexadecimal number 1-F, if for example the above entry would result in 6.)

    I tried to use the function of text file reading, but I don't know how to convert then the entrance of my desired format.

    Also if you have any idea on how to start playback at the first 1, and then read the next 4 entries contact that would be great as well.

    Any help is really appreciated!


  • Question about the game database and the UNICODE character

    Hello

    I have to configure a database for an IBM product where is a requirement:
    "Databases must be created using the UNICODE database and National characters as UTF8 games, AL32UTF8 or AL16UTF16 or."

    My current database character is: WE8MSWIN1252. Change the current database character set is not an option, so I have to create a new db for this requirement.

    My question is:
    (1) how to ensure that "databases must be created using the UNICODE database"?

    (2) to take care of character, I'll use in the database creation script:

    "
    create the db1 database...
    ..
    CHARACTER SET US7ASCII
    NATIONAL CHARACTER SET AL16UTF16
    .."
    who will take care of him?

    create the db1 database...
    ..
    UTF8 CHARACTER
    NATIONAL CHARACTER SET AL16UTF16

  • How to read the Picker RGB values?

    By clicking and dragging the image, a selector of RGB value window apppears. However, I don't know exactly what information it's display.

    There are X and think I beliee is the resolution or the axis on where you are in the image.

    Then there is RGB, which is obviously red, green and blue.

    But there are HLS and then under that, RGB again and again, HLS...

    Can someone pelase explain what it means and what they are used for?

    Thank you very much!

    Hi Dezzy,

    X and are indeed describe the position of the pixel compared to your actual image size. Top left is always equal to 0.0. Image HD, top right would be 1920,0

    The two columns of values RGB and STL describe the image before and after the classification.

    Discover the behavior by making a very obvious change in the. Look at the Panel, and then check the values in the color picker. If the offset allows you to transform the image all redish (45 degrees right / up), you will notice that the Red classified values is increased, green declined, while blue remains the same.

    See you soon,.

    Pat

  • D2KWUTIL Read_Registry - only reads the string values? How to read the binary?

    Hello, everyone!
    I use forms and reports 6
    D2KWUTIL,
    WIN_API_ENVIRONMENT. Read_registry
    to read the Windows registry values.
    The service works very well with string values (that is, type REG_SZ registry).
    but fails with NO_DATA_FOUND binary values, such as type REG_DWORD.

    D2KWUTIL is really unable to work with other types of chains?
    If so, what can be used instead?

    Appreciate all the guidance,
    Roman

    Published by: user9232995 on November 18, 2010 23:19

    Published by: user9232995 on November 18, 2010 23:20

    It's d2kwut60.dll.

  • Display garbage instead of Unicode character

    Hello

    IAM, go search for the content web service & after treatment of response when I view the content on-screen RichTextField as the unicode character ($, #, has ^ etc.) are displayed in the form of waste...

    But to my surprise when I try to show these characters in the field of rich text as hardcoded (by storing it in a string variable) without fetching web service, they are presented as usual...

    Anyone has an idea why this is happening...?

    Will I have to do something while recovering from web service so that unicode characters are not displayed as garbage...?

    Any kind of help would be appreciated...

    Thanks in advance...

    No problem, I was just letting you know that my explanation would be not that great because I can never get my head round it...

    In any case, assuming that you develop for 4.2 or later, replace this (which is in any way questionable code):

    data Byte [] = new byte [in.available ()];
    int len = 0;
    int size = 0;
    Gross StringBuffer = new StringBuffer();
    While (-1! = (len = in.read (data)))
    {
    RAW. Append (new String (data, 0, len));
    size += len;
    }
    String content = raw.toString ();

    with this, much easier to read the code:

    Byte [] IOUtilities.streamToBytes = data (en);
    The contents of the string;
    try {}
    content = new String (given, "UTF - 8");
    } catch (Exception e) {}

    never happen, UTF - 8 is supported

    }

  • Problems with reading the series bytes

    Hello

    I currently have a PIC18F microcontroller serial communication with LABview using the base read and write.vi series. The PEAK sends strings such as "V222! (V is the character of the header, and! being the end character). Then, I have a program to take each individual character read and concatenate them in a larger string for data extraction. The port has been configured to 38400 baud and be only a single byte of long.

    The captain sends this one byte at the time and the problem here is that LABview seems to be only reading V most of the time, and occasinally has 2. Since it doesn't seem to be never read the end character, the sequence of extracting data from my code is never executed.

    A few questions I have are:

    The captain may send one byte at a time, but also all other devices communicate through a serial port.  The definition of the serial port involves both a byte.  Actually it's really a LITTLE at a time.  But serial port parameters leads to the gathering of 7 or 8 bits to produce a byte.  The PEAK sends a follow-up byte to another byte, etc.  The time between shipments of the byte may be too small to read contiguously in your Labview program.

    At very slow speeds, it could really work.  At 300 baud (3mS / bit), there are 33 mS to send a byte (8-bit + stop bit, start bit).  So if your loop runs fast enough, you get every byte one at a time.  But there is the overhead of other code to store the bytes, etc..

    38000 baud to only 0.2 mS to send a byte.  LabVIEW is not fast enough to loop at this rate to capture all the bytes individually.

    But why bother?  Simply capture all the bytes and treat them as a complete message.

  • Read the table xmldata

    Hello

    I created the following contains only one column

    create the table book_inf (booksinf clob);

    the booksinf column contains the following xmldata
    <BOOKS>
      <BOOK-ID> I1001 </BOOK-ID>
      <BOOK-NAME> SQL </BOOK-NAME>
    </BOOKS>
    How to read the book id values and the book-name one by one using DBMS_LOB.

    can someone help me... ?

    You would be better using an XMLTYPE column to store your XML data.

    SQL> create table book_inf(booksinf XMLTYPE);
    
    Table created.
    
    SQL> ed
    Wrote file afiedt.buf
    
      1* insert into book_inf(booksinf) values (XMLTYPE('I1001SQL'))
    SQL> /
    
    1 row created.
    
    SQL> ed
    Wrote file afiedt.buf
    
      1  select x.*
      2  from   book_inf
      3        ,xmltable('/BOOKS'
      4                  passing book_inf.booksinf
      5                  columns book_id   varchar2(20) path './BOOK-ID'
      6                         ,book_name varchar2(20) path './BOOK-NAME'
      7*                ) x
    SQL> /
    
    BOOK_ID              BOOK_NAME
    -------------------- --------------------
    I1001                SQL
    
  • Reads OCR training character, but not the program labview

    I am training characters, then check my program is able to read the same characters. Every article I read has 8 of the same characters in different parts of the King. Because it is a curved surface, each position is formed independently. 3 the posistions, I formed the character '5' and it will recognize without any problem in the roc training program. Using the exact same ROI, it will not read the characters in my program. All settings, IE the resolution read, read strategy, erosions, etc. are the same in both programs. It notes the character, don't know what it is. I use non-linear threshold. Indicator report of character, I took the threshold values, it uses in my program and is entered as a range threshold fixed on the formation of ocr. This turned the blue character just as expected and read without any problem. Unless there is a setting I'm missing, it seems that the OCR Application does not use the text for reading OCR Idem 3 I use in my program. Any suggestions? I know it's complicated, I'll add the image and a screenshot showing what I mean

    I fixed it! I became crazy and set all the properties of ocr, even those I was using just the default setting. Weird.

  • Error reading the port series when the hexadecimal value is 0d (carriage return)

    Hello

    I'm reading a string of 80 bytes from the serial port, but if one of these bytes is 0d (hexa) the rest of the bytes are not read because the read node Visa sees the value 0D as ASCII for the return shipping. How can I read the entire string and see the 0d as a value and not as a symbol of the ASCII?

    Manual

    Of course, she sees it as a carriage return and ends. That's what you have programmed to do. The "character of endpoint allows" set to false with your VISA to set up the Serial Port. What Steve has already said. Claire?

  • How to read the value of the javascript component text entry

    Hello

    I need to add ' / ' after user entering the first two characters and before entering the third character of character to the value of input text.
    To meet this requirement, I add a clientListener of type keyPress to input text element.
    My question is how to read the value entered by the user to input text in java script component (the clientListener method).

    I faked my requirement in a sample application @ http://www.easy-share.com/1912896093/format.7z

    Please help solve this problem.

    Thank you
    Kiran

    For setting/getting the value, you can even view:




    function keyPress (event) {}
    component = event.getSource ();

    Alert (Component.getSubmittedValue ());

    {component.setValue ("new value '");}
    ]]>

    Thank you
    Nini

  • read the independent values in a channel

    Hello

    I want to read the value of a chanel.

    I guess that every chanel's store as an array with an index and a value.

    I would like to read a value of a chanel with its index number, then do some calculations, and then write to it.

    For example:

    Chanel 1:
    index value
    1           1
    2           1
    3           1
    4           2
    5           1
    6           1

    start index = 0
    value > 1?
    If no control of the following
    If so do something

    Do you have a sample script to read a unique value in a chanel?

    Kind regards

    Frédéric MANUAL

    OK, so it should work

    Dim oChn, K, value
    "Go to the channel you are interested in.
    Set oChn = data. GetChannel ("Time")

    ' loop through all the values
    For K = 1 To oChn.Size
    Value = oChn (K)
    If (value > 1) then
    "do something
    MsgBox ("value WG 1")
    End If
    Next

  • correctly when reading the negative value

    Hi all,

    It's about power meter device. in fact, I've already got the good value here, but I create additional calculations. the situation is:

    When the power reading is positive, I enjoy reading.

    power is negative, I misread (high value). so I need to subtract this value to 2 ^ 32 (or 4294967296).

    is that someone he knows the reason why he needs to happen?

    OK, "registers" are tables of U16. so try to typecast I32. How many elements in the table?

    Somehow, you do everything with tables, but you only display one item. It almost seems to me that everything going primitive "contact numbers" be given ordinary scalars. There are also a lot of duplicate code. You might get away with an instance and a loop FOR, for example.

    Representations of data are a mess with a wild mix of types of data and constraints. The Psum (High value) is I64 without reason (under the constraint of a DBL two values U32 (?) division). I do not understand the function of the Subvi. Can you explain?

    You can place an indicator of one of the 'registers' tables, run the VI so it contains data, then turn the indicator in a constant of schema that contains the typical data (Right-Click... change to constant). Save and attach the VI.

  • How to read the value of list boxes by iteration in a loop For?

    I have a lot of list boxes on the front of my VI. I want to know how to read the value of this combo with a loop boxes For. The point is that I don't know how to get the reference of each combo box in a loop.

    Any information would be welcome. Thank you!

    su27 wrote:

    I have a lot of combo boxes on the front of my VI [...]

    Be sure to close the references that you have finished with them.

Maybe you are looking for

  • Firefox is declining as being vulnerable even though I installed the latest version of Adobe Flash Player. Why is this?

    I have the latest version of Adobe Flash installed 18.0.0.203 - this is confirmed on the adobe site and the Firefox Add-ons page. Yet I continue to get the message saying that Flash Player is vulnerable...

  • Satellite A200 - 1 M 8 and installing XP

    I bought this laptop and Vista has been installed. I went to hell hollow until I finally managed to remove it (found help on this forum). But I still need help. Here's what I did. I was in a place of friends and we copied Matrix Storage Manager on a

  • ThinkPad x 1 carbon SIM

    Hello world I have a question about the SIM card in x 1 carbon. I'm not very good with technology, so I do not know if my x 1 carbon has a working SIM slot. It has a slot for SIM card, but when I put it, it does not do anything, like "detection" or s

  • pilot identifying material

    s my hp probook 4540 systen showing an unknown device as one install. follow the hardware ID PCI\VEN_8086 & DEV_1E31 & SUBSYS_17F6103C & REV_04PCI\VEN_8086 & DEV_1E31 & SUBSYS_17F6103CPCI\VEN_8086 & DEV_1E31 & CC_0C0330PCI\VEN_8086 & DEV_1E31 & CC_0C

  • How I shortened desktop cleanup and unused icons

    I have a hp Pavilion dv2615nr entertainment notebook pc withos windows vista Home premium windows version 6 architecture: x 86