Convert non-ASCII character to decimal value

Hi all,
I have the following problem:
When reading a String containing the full spectrum of UTF-8 characters from a BufferedReader:
How can I get the decimal value of the String's characters outside the ASCII range?
When I try to do a MyBufferedReader.read(), I get the int value 65533 for these characters, instead of their real value in the UTF-8 set.
Can anyone help?
Thanks!
Dre

That's the character you get when you try to decode a character with no valid decoding. Of course there aren't any such characters for UTF-8. Therefore whatever you did, don't do that. More specifically: you've already got a String, don't do anything which involves converting it to bytes. That's completely unnecessary.
Or perhaps the problem is the way you create the String in the first place. Who knows?

Similar Messages

  • How do I convert the ASCII character % which is 25h to a hex number. I've tried using the scan value VI but get a zero in the value field.

    How do I convert the ASCII character % ,which is 25h, to a hex number 25h. I've tried using the scan value VI but I get a zero in the value field. 

    You can use String to Byte Array for this.

  • Unicode value of a non-ASCII character

    Hi,
    Suppose, the unicode value of the character ् is '\u094d'.
    Is there any Java function which can get this unicode value of a non-ASCII character.
    Like:
    char c='्';
    String s=convertToUnicode(c);
    System.out.println("The unicode value is "+ s);
    Output:
    The unicode value is \u094d
    Thanks in advance

    Ranjan_Yengkhom wrote:
    I have tried with the parameter
    c:\ javac -encoding utf8 filename.java
    Still I am getting the same print i.e. \u3fIf it comes out as "\u3f" (instead of failing to compile or any other value), then your source code already contains the question mark. So you already saved it wrong and have to re-type it (at least the single character).
    >
    Then I studied one tutorial regarding this issue
    http://vietunicode.sourceforge.net/howto/java/encoding.html
    It says that we need to save the java file in UTF-8 format. I have explored most of the editors like netbean, eclipse, JCreator, etc... there is no option to save the java file in UTF-8 format.That's one way. But since that is so problematic (you'll have to remember/make sure to always save it that way and to compile it using the correct switch), the better solution by far is not to use any non-ASCII characters in your source code.
    I already told you two possible ways to achieve that: unicode escapes or externalized strings.
    Also read http://www.joelonsoftware.com/articles/Unicode.html (just because it's related, essential information and I just posted that link somewhere else).

  • Non-ASCII character in Email field

    Hi Guys,
    I am trying to enter non-english characters in Email field of user form, but OIM throws an error that "A non-Ascii character has been entered". I have also tried to turn off the AppFirewall Filter in xlConfig.xml file but no help. Is there any way thay I can enter non-Ascii characters in Email field?
    Regards,
    Rahul

    .oO(surfinIan)
    >I have a script that converts a ms word document to text
    then uploads that to a
    >blob field on a mysql db.
    > During the conversion some characters my not be
    recognised. When i then call
    >up the blob for display on the browser...those characters
    show up as unknown
    >characters with a ? or box. Is there a way to
    preg_replace those unknown
    >characters before displaying them.
    What about fixing the encoding problem instead? If chars get
    lost during
    such a transfer
    document->script->database->script->browser it's always
    an encoding problem somewhere down the road.
    The recommendation these days is to use UTF-8, which avoids
    most of
    these old problems. You just have to make sure that your
    documents are
    properly stored as UTF-8 in the database and delivered as
    such to the
    script and the browser, then you don't have to worry about
    special chars
    anymore.
    That's just the general idea. I can't be more specific, since
    I don't
    know your conversion script or the database structure.
    Micha

  • [Solved] no non-ASCII character input in rxvt-unicode

    Hello everyone,
    For some days now, I can't write any non-ASCII characters any more in rxvt-unicode and rxvt-unicode-patched. Unfortunately, downgrading the rxvt-unicode package doesn't seem to help. To have at least a temporary solution, I'd like to know at least which packages I could try to downgrade as well. Any ideas, anyone?
    greez,
    maxmin
    Last edited by Maximalminimalist (2011-03-12 13:12:26)

    When I try to type a non-ASCII-character I get nothing at all. This happens with my custom keyboard layout (modified programmer dvorak) and in some layouts I already tried (us: altgr-intl, ch, de and fr)
    When I paste a non-ASCII characters in rxvt-unicode I get
    maxmin ~ $ ?
    This happens only on my x86_64 desktop which is more up to date than my i686 laptop. (I'm afraid now to do any updates.)
    EDIT: I'm sorry, I don't know what you mean with locale settings. What do you mean with that?
    EDIT2: Maybe just typing locale in the terminal is what you mean:
    maxmin ~ $ locale
    locale: Cannot set LC_CTYPE to default locale: No such file or directory
    locale: Cannot set LC_MESSAGES to default locale: No such file or directory
    locale: Cannot set LC_ALL to default locale: No such file or directory
    LANG=en_US.utf8
    LC_CTYPE="en_US.utf8"
    LC_NUMERIC="en_US.utf8"
    LC_TIME="en_US.utf8"
    LC_COLLATE="en_US.utf8"
    LC_MONETARY="en_US.utf8"
    LC_MESSAGES="en_US.utf8"
    LC_PAPER="en_US.utf8"
    LC_NAME="en_US.utf8"
    LC_ADDRESS="en_US.utf8"
    LC_TELEPHONE="en_US.utf8"
    LC_MEASUREMENT="en_US.utf8"
    LC_IDENTIFICATION="en_US.utf8"
    LC_ALL=
    With other terminal emulators I get sometimes also nothing and sometimes right displayed but wrong interpreted character in vim. I didn't take notes while doing that but I'll try again if needed.
    Last edited by Maximalminimalist (2011-03-06 21:51:23)

  • ALV Grid bug when dealing with non-ASCII character

    Dear all,
    I have a requirement to display user's remarks on ALV.  The data element of the remarks column is TEXT200.  I know that each column in an ALV Grid can display at most 128 characters.  Since my SAP is an Unicode system, I expect that each column in my ALV Grid can display 128 Chinese characters, too.  However, the ALV Grid only display 42 Chinese characters at most.  Is this a bug in ALV Grid?  How can I fix it?
    I did a small experiment.  The results are listed below.  My version is Net Weaver 7.01.  The results show that the bug does not exist in ALV List.  However, my user prefers ALV Grid, which is more beautiful and elegant.
    Type of ALV
    Max number of
    ASCII character
    in an ALV column
    Max number of
    non-ASCII character
    in an ALV column
    REUSE_ALV_GRID_DISPLAY
    128
    42 Chinese characters
    CL_SALV_TABLE
    128
    42 Chinese characters
    CL_GUI_ALV_GRID
    128
    42 Chinese characters
    REUSE_ALV_LIST_DISPLAY
    132
    132 Chinese characters
    If you encounter the bug, please post your solution.  Thanks a lot. 

    It looks like limitation of ALV grid cell, which can contain up to 128 bytes in SAP gui.
    Your unicode characters are probably 3 bytes each.
    Check OSS Note 910300 for more detailed info.
    EDIT: Note 1401711 seems to be a correction for your issue It allows to use 128 characters (even if they take more than 128 bytes).

  • Is Linksys WRT54GH SSID can contains the non-ascii character?

    is Linksys WRT54GH SSID can contains the non-ascii character?
    we need to use it for our wireless testing, but i dont know if the SSID can contains non-ascii.
    anybody can help me? hurry, i will wait answer online.
    thanks in advance!
    Solved!
    Go to Solution.

    thank you  very much, Ricewind
    SSID cant contain non-ascii characters, it make me sad and disappointed
    why we can  set T-link router SSID with non-ascii characters?

  • Remove non ascii character

    i need a SQL or Procedure that will search non ascii character  in data and update the data by removing it
    Suppose there is table TABLE1 with Column NAME
    it contain number of row and few has non ascii character eg 'CharacterÄr'
    My sql or procedure should be able to search  'CharacterÄr' and update the row with 'Character'
    i.e. removing the non ascii character 'Ä' from the data

    Hi,
    Okay, in that case:
    SELECT str
    ,      REGEXP_REPLACE ( str
                          , '[^[:cntrl:] -~]'
                          )   AS new_str
    FROM    table_x
    or, to actually change the rows that contain the bad characters:
    UPDATE  table_x
    SET     str = REGEXP_REPLACE ( str
                                 , '[^[:cntrl:] -~]'
    WHERE   REGEXP_LIKE ( str
                        , '[^[:cntrl:] -~]'

  • How to convert signed ascii hex to float value

    Hi,
    I have a requirement to convert IEEE ascii hex to float value.
    Following code is working for +ve float value but it didn't work for -ve.
    public static float hexToFloat(String str){
              float floatVal= 0.0f;
              int decimalValue =Integer.parseInt(str,16);
              floatVal=Float.intBitsToFloat(decimalValue );
              return floatVal;
    for example "BE4CE1E6" should return -0.20 . (i verified in http://babbage.cs.qc.edu/IEEE-754/32bit.html )
    For the above string I am getting number format exception.
    pls help me.

    The problem is the parseInt method. It can only process numbers up to 2147483647 or 7FFFFFFF. Because that method expects a signed number.
    The solution is to use Long.parseLong() instead.
    public static float hexToFloat(String str){
    float floatVal= 0.0f;
    int decimalValue =(int)Long.parseLong(str,16);
    floatVal=Float.intBitsToFloat(decimalValue );
    return floatVal;
    }

  • Find the Special character and non Ascii character

    Hi:
    i have table ,this table column name contain some datas like
    sno name
    1 CORPORATIVO ISO, S.A. DE C.V.
    2 (주)엠투소프트
    3 TIMELESS
    4 南京南瑞集团公司
    5 PHOTURIS
    6 Ace Informática S/C ltda
    7 Computacenter AG & Co. oHG
    8 아이티앤씨
    9 MOCA
    10 anbarasan
    my requirement:
    1)i need to search the name column where contain the special character and non ascii character..if found any non ascii or spcial character ..need to say flag ''yes".if not found need to say "no"...kindly help on this issus...

    i need some example..i am not have any idea....
    i have table ,this table column name contain some datas like
    sno name
    1 CORPORATIVO ISO, S.A. DE C.V.
    2 (주)엠투소프트
    3 TIMELESS
    4 南京南瑞集团公司
    5 PHOTURIS
    6 Ace Informática S/C ltda
    7 Computacenter AG & Co. oHG
    8 아이티앤씨
    9 MOCA
    10 anbarasan
    my requirement:
    1)i need to search the name column where contain the special character and non ascii character..if found any non ascii or spcial character ..need to say flag ''yes".if not found need to say "no"...kindly help on this issus...

  • How do I convert an ASCII character to an array of co-ordinates.

    I need to convert and ASCII character to an array of X, Y co-ordinates. I also need to be-able to vary the size of the text (scale of graph i suppose) and position on the graph So i can desplay multiple characters on a graph. However it needs to be stored in an array (or set of arrays) so i can isue these co-ordinates to an instrument.

    Maybe the attached VI can help. Using picture control functions, it get the
    1bit bitmap of the character/text
    on input in a 2D array of booleans.
    Jean-Pierre Drolet
    "m0mbaj0mba" a écrit dans le message news:
    [email protected]..
    > I am trying to find a simple way to convert a letter (ASCII character)
    > into an array of X,Y co-ordinates. I am involved in two projects that
    > involve spelling letters with lasers. At the moment we are plotting
    > the points on a graph in excel, transferring the co-ordinates into a
    > text file and then converting the content of these text files into a
    > set on 1D arrays. As I am sure you can appreciate this is a very long
    > winded process. Is there anyway of pl
    otting points on an X,Y, graph
    > and outputting those points to an array or set of arrays?
    >
    > Excel spreadshett is attached.
    [Attachment GetTextBitmap.vi, see below]
    LabVIEW, C'est LabVIEW
    Attachments:
    GetTextBitmap.vi ‏45 KB

  • Keyword import fails on non-ascii character

      I recently tried to import a long set of keywords (about 4000 terms).  i set up the file in excel and then tried to import the records.  I kept getting this message:  
    only text files encoded with ascii or unicode UTF-8 are supported when importing keywords.
    I finally tracked down the problem when i converted the file to a MS word text file, broke it down into parts and eventually found the problem record.  for some reason, the apostrophe in the words "don't know" had been corrupted to a weird character.  after i corrected this, everything worked. 
    however, this took a long time.   It would have been helpful if  lightroom could have at least pinpointed the line where the import failed or offered to convert non-compliant charaters to some specific character or set of characters.

    Yeah, that didn't work so well since SuperDuper ran across repeated errors trying to do so; I suspect it's something to do with the drive. (SuperDuper complains about WD's MyBook, which is what the drive is.) Because SD stops the entire copy operation on single errors, it'd be a painstaking process.
    Besides that, I like doing fresh installs of all the bits.

  • Non-ascii character problem

    hi
    Scenario: Reading Flat-File and writing into Oralce Table.
    In my database procedure, I have declared a column say X as VARCHAR2 to store string values. In the flat-file, some times the data for column X comes as Non-ASCII string values (e. SäHKOTOIM) and because of this the database procedure raises ORA-06502:PL/SQL:numeric or value error.
    So, how I can identify that the flat file has non-ascii values so that I can reject that record and move with another record?
    your suggestion will be greatly appreciated.
    Regards
    shakeel

    Hi,
    You set you nls_database_parameters which is compatiable with you input (non- ascii) characters.
    Try to use the LCSSCAN in order to know the relevant character set with respective to input and set the nls_parameters
    https://students.kiv.zcu.cz/doc/oracle/server.102/b14225/ch12scanner.htm#i1016925
    - Pavan Kumar N

  • Converting non-ascii characters generated by MS word

    Hello,
    I've encountered some files that were originally exported from MS Word as html. The problem is they contain some characters that fall into the 128 to 255 range. Some appear to be fancy quotes and apostrophes, but others I just can't figure out. On a mac or Firefox on windows they appear as:
    Ö ë í ì î ñ ô † © Æ ∑ ∆ “ ÷ › · Î Ï Ì Ó Ô Ò Ù
    The decimal values of the above chars are:
    133 145 146 147 148 150 153 160 169 174 183 198 210 214 221 225 235 236 237 238 239 241 244
    As charater entities they appear as:
    … ‘ ’ “ ” – ™ © ® · Æ Ò Ö Ý á ë ì í î ï ñ ô
    Before I try to reinvent a square wheel, I thought I'd ask here if anyone knows of an existing command line tool that might help with this.
    Cole
    15 PB   Mac OS X (10.3.9)  

    Thanks for all the replies. I think I've solved the problem. It indeed was a problem with high bit WinLatin1 (cp 1252) characters. Here's a technote that discusses the problem. So I wrote a short perl script based on this table:
    <pre style="overflow: auto;font-size:small; font-family: Monaco, 'Courier New', Courier, monospace; color: #222; background: #ddd; padding: .3em .8em .3em .8em; font-size: 10px;">#!/usr/bin/perl -wpi
    # Define an array for double byte unicode characters
    # Undefined characters are marked as 0.
    my @uni = (
    8364, 0, 8218, 402, 8222, 8230, 8224, 8225,
    710, 8240, 352, 8249, 338, 0, 381, 0, 0,
    8216, 8217, 8220, 8221, 8226, 8211, 8212,
    732, 8482, 353, 8250, 339, 0, 382, 376
    # Characters 128 through 159 are mixed set of double byte unicode characters,
    # so get these out of our $uni array. Undefined characters in this range are deleted.
    s/([\x80-\x9f])/ $uni[ord($1)-128] ? sprintf("&#%d;", $uni[ord($1)-128]) : ""/eg;
    # Characters 160 through 255 can be used as is.
    s/([\xa0-\xff])/sprintf("&#%d;", ord($1))/eg
    </pre>I only hope that perl is clever enough to not create the $uni array for each line. Anyone happen to know?
    Thanks for any tips.
    Cole

  • How can i convert an ascii character to a number?

    where can I find the function?

    A string will be converted to an array of U8.
    Unless you convert a single character.
    RayR
    Message Edited by JoeLabView on 06-27-2008 05:39 PM
    Attachments:
    Str2Num.vi ‏7 KB
    String2Number.PNG ‏7 KB

Maybe you are looking for