Problem in Converting String (containing arabic) to HEX

Hi,
I am trying to convert Arabic Text stored in a String into HEX format.
The arabic range in unicode is: 0600�06FF
But when i convert using Integer.toHexString(), i get hex values which are not in the above range.
Here goes the code:
for(int i=0;i<text1.length();i++)
if((int)text1.charAt(i)<10) {
hextext+="0"+Integer.toHexString(text1.charAt(i)).toUpperCase();
else {
hextext+=Integer.toHexString(text1.charAt(i)).toUpperCase();
Regards,

http://forum.java.sun.com/thread.jspa?threadID=682398&messageID=3975945#3975945

Similar Messages

  • Facing problem in converting string to date using getOANLSServices()

    I am trying to set a value for date field in my vo and trying to insert into the table.
    In controller I am getting the String which has a date:
    ex: String date="01-NOV-2007";
    while setting into the row I need to convert into Date but it is returning null.
    The below code I used
    to convert into date :
    Date dt = new Date(getOADBTransaction().getOANLSServices().stringToDate(date));
    But this dt is returning a null value is there any solution please advise me.
    Regards!
    Smarajeet

    Smarajeet ,
    See this thread, in one of my replies i have mentioned how to convert string to java.sql.date.You can use the same for oracle.jbo.domain.Date.
    urgent!How to set the default selected date for an OAMessageDateFieldBean
    --Mukul                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Problem in Converting string to float

    Hi,
    I am reading from textField and trying to convert that string value to float.
    Compiler is giving error cannot find symbol toFloat even though I have included java.lang in my program.
    Please help me with this one.
    Thanks.

    Use
    float f = Float.parseFloat(inputString); //where inputString is the string you want to parse

  • Converting String to RGB or hex

    I've got string
    "C0C0C0"
    which is grey color, and I have to convert it to int:
    0xC0C0C0
    is that possible in J2ME?

    Cinnam wrote:
    There's no such constructor in MIDP. You'll have to use
    int hexInt = Integer.parseInt("C0C0C0", 16);
    yeah thats right. i kinda wrote that in a hurry
    to err is human, forgive divine.

  • How to convert string containing comma seperated values to an array

    my requirement is i have to first convert an comma seperated string to an array
    after that i have to pass the array values to a for loop
    eg:i have a string str=(456,457,487,465,478)
    These values i have to put in an array.
    i then i have to pass the array values to a for loop

    We understand your ¿homeworks? We are helping you, but it seems like you want us to do it.
    Try it yourself with some of the instructions.
    Anyway if there aren´t homeworks, use dinamyc sql:
    declare
    varray := '(45,65,12,4)';
    begin
    execute immediate 'update table set ss=''uu'' where id in ' || varray;
    end;

  • Problem in  Converting String to Date

    Hi All,
    I am having one String
    String date = "2006-01-17 15:19:57.0"
    I want to parse this String into Date object.
    I will really appriciate if somebody helps me out.
    Thanks.

    You're specifying a 'T' and a timezone in your format, but they're not present in the string you're parsing.
    I'm assuming from the way you're printing out the date, that your thinking is along these lines: "sdfInput will parse the input string, no matter what format it's in, and will produce a Date object. That Date object wil have the format specified in sdfInput."
    This is wrong on a couple of fronts:
    1) DateFormat doesn't magically figure out what format it's supposed to use for the String it's parse()ing. The String has to match the DF's format.
    2) Dates don't have formats. Only Strings do. A Date object is just a long. There's no relationship whatsoever between the Date that you get from parse() and the format that was used to produce it. When you print out a Date as you're doing, its toString method is called, which in turn uses a default format for your Locale.
    If you want to turn a date string in one format into a date string in another format, use two different DateFormat objects with two different formats. Date date = df1.parse(inputString);
    String outputString = df2.format(date);

  • Converting string containing multiple numbers to numbers eg.(1,2,3)

    SQL only for report (in Hummingbird... sigh...)
    example code:
    select * from table
    where numberfield in
    (select varchar2field from othertable where this = that)
    (select varchar2field from othertable where this = that) output: 125,458,784,56,895,121545,8
    i need oracle to run it like:
    select * from table
    where numberfield in
    (125,458,784,56,895,121545,8)
    and
    example code:
    select * from table
    where x in
    (select varchar2field from othertable where this = that)
    (select varchar2field from othertable where this = that) output: Select x from y
    i need oracle to run it like:
    select * from table
    where x in
    (Select x from y)

    SQL> WITH NUMBERS AS
      2       (SELECT '123,456,77889' AS NUMBERFIELD
      3          FROM DUAL), DATA AS
      4                     (SELECT 123 AS NUM FROM DUAL UNION ALL
      5                      SELECT 234   FROM DUAL UNION ALL
      6                      SELECT 125   FROM DUAL UNION ALL
      7                      SELECT 145   FROM DUAL UNION ALL
      8                      SELECT 77889 FROM DUAL)
      9  SELECT NUM
    10    FROM DATA, NUMBERS
    11   WHERE INSTR(',' || NUMBERS.NUMBERFIELD || ',', DATA.NUM) > 0
    12  /
           NUM
           123
         77889hth, Urs

  • Strange problem in converting between XML to string and vice versa

    i have an application that needs to send an XML document
    over the wire. For this reason, I need to convert the
    doc into a String at the sending side and back to Doc
    at the receiving side. This document is stored in a "CLOB"
    column in a table in the database. I use XDK to retrieve
    this entire row (including the CLOB - hence this is an XML
    document which has a column that itself is an xml document in
    string format - this is just the clob read in by XDK).
    Thus the row looks like
    <ROWSET>
    <ROW>
    <col1> A <col1>
    <CLOB_COL> ..clob value of an xml doc..</CLOB_COL>
    </ROW>
    </ROWSET>
    When I convert this document into String and back, one of the "<"
    tags in the clob column document gets changed to "&lt;" and hence
    the parsing fails! I have used the latest label of the XDK build
    to get the latest parser jar but still i have the same problem.
    I am using the following routines for the conversion.
    /* for converting document to string */
    public static String convertToString(XMLDocument xml) throws
    IOException
    StringWriter sw = new StringWriter();
    PrintWriter pw = new PrintWriter(sw);
    xml.print(pw);
    String result = sw.toString();
    return result;
    /* for converting string to document */
    public static XMLDocument convertToXml(String xmlStr)
    throws
    IOException,SAXException
    ByteArrayInputStream inStream = new
    ByteArrayInputStream(xmlStr.getBytes());
    DOMParser parser = new DOMParser();
    parser.setPreserveWhitespace(false);
    parser.parse(inStream);
    return parser.getDocument();

    How do you get the XML document? Do you use XSU? You can use:
    String str = qry.getXMLString();
    to get the result XML document in String.
    XSU will escape all of the < and >. Or the the XML document in
    one of the column will make the result XML doc not well-formed.
    Not quite understand your problem. You can send me your test
    case.
    i have an application that needs to send an XML document
    over the wire. For this reason, I need to convert the
    doc into a String at the sending side and back to Doc
    at the receiving side. This document is stored in a "CLOB"
    column in a table in the database. I use XDK to retrieve
    this entire row (including the CLOB - hence this is an XML
    document which has a column that itself is an xml document in
    string format - this is just the clob read in by XDK).
    Thus the row looks like
    <ROWSET>
    <ROW>
    <col1> A <col1>
    <CLOB_COL> ..clob value of an xml doc..</CLOB_COL>
    </ROW>
    </ROWSET>
    When I convert this document into String and back, one of the "<"
    tags in the clob column document gets changed to "<" and hence
    the parsing fails! I have used the latest label of the XDK build
    to get the latest parser jar but still i have the same problem.
    I am using the following routines for the conversion.
    /* for converting document to string */
    public static String convertToString(XMLDocument xml) throws
    IOException
    StringWriter sw = new StringWriter();
    PrintWriter pw = new PrintWriter(sw);
    xml.print(pw);
    String result = sw.toString();
    return result;
    /* for converting string to document */
    public static XMLDocument convertToXml(String xmlStr)
    throws
    IOException,SAXException
    ByteArrayInputStream inStream = new
    ByteArrayInputStream(xmlStr.getBytes());
    DOMParser parser = new DOMParser();
    parser.setPreserveWhitespace(false);
    parser.parse(inStream);
    return parser.getDocument();

  • Excel problem StarStarStarStarStar Written by MA from Dubai  i have problem in excel when i write Arabic or i receive any excel file contain Arabic word it come like letters it do not come like word my Microsoft office is 2011 what i can do

    excel problem
    i have problem in excel when i write Arabic or i receive any excel file contain Arabic word it come like letters   it do not come like word
    my Microsoft office is 2011
    what i can do

    MS Office for Mac does not really support Arabic.  But you may just have a font problem.  Disconnected letters means a Windows font is being used.  Change the font to a Mac font like Geeza Pro.
    For better Arabic support, try OpenOffice.

  • Problem in converting english text to arabic text in Acrobat XI professional

    Hi,
    One of our client is facing issue while converting english text to arabic text in Acrobat XI professional. Can somebody help me to find a solution for this.

    Ok , that is clear the customer has another query. He is trying to convert a pdf Arabic file into word formate but it is showing arabic font which is not in a proper form.i am attaching the print screen .

  • Converting byte from dec to hex

    Hi All,
    I'm having a problem converting byte from decimal to hex - i need the following result:
    if entered 127 (dec), the output should be 7f (hex).
    The following method fails, of course because of NumberFormatException.
        private byte toHexByte(byte signedByte)
            int unsignedByte = signedByte;
            unsignedByte &= 0xff;
            String hexString = Integer.toHexString(unsignedByte);
            BigInteger bigInteger = new BigInteger(hexString);
            //byte hexByte = Byte.parseByte(hexString);
            return bigInteger.byteValue();
        }

    get numberformatexception because a lot of hex digits cannot be transformed into int just like that (ie f is not a digit in decimal) heres some code that i used for a pdp11 assembler IDE... but this is for 16-bit 2s complement in binary/octal/decimal/hex , might be useful for reference as example though
        public static String getBase(short i, int base){
            String res = (i>=0)? Integer.toString((int)i,base)
                    : Integer.toString((int)65536+i,base) + " ("+Integer.toString((int)i,base)+")";
           StringBuffer pad= new StringBuffer();
            for(int x = 0; x < 16 - res.length() ; x++){
                pad.append("0");
            res = pad.toString() + res;
            return res;
        }

  • Converting String to byte array

    Hi,
    There is a code for converting String to byte array, as follows:
         public byte[] toByteArray(String s)
              char[] c = s.toCharArray();
              int len = c.length;
              byte[] b = new byte[len * 2];
    for ( int i = 0 ; i < len ; i++ )
         b[i * 2] = (byte)(c);
         b[(i * 2) + 1] = (byte)(c[i] >> 8);
    return b;
    But this isn't doing the conversion properly. For example, for the � (euro) symbol, it converts to some other unreadable symbol. Also, same is the case for square brackets. Any idea why this' so? What's wrong with the above code?
    The encoding format is UTF-8.
    Thanks.

    > In fact, I tried with String.getBytes() too, but leads to the same problem, with those specific symbols.
    Did you try the String.getBytes(String charsetName) method?
    Both methods have been around since Java 1.1.
    It's an extremely important skill to learn to read the API and become familiar with the tools you will use to program Java. Java has an extensive set of online documentation that you can even download for your convenience. These "javadocs" are indexed and categorized so you can quickly look up any class or method. Take the time to consult this resource whenever you have a question - you'll find they typically contain very detailed descriptions and possibly some code examples.
    Java� API Specifications
    Java� 1.5 JDK Javadocs
    Best of luck!
    ~

  • Can the encrypted string contain only alphabets?

    Hi friends,
    I have problem with the encryption. I am using Des .
    I want to get the encrypted string which contains only alphabets ( no digits or no special characters).
    Help appreciated.
    Thanks.

    Within the Java Cryptographic Extension (JCE), encryption works on bytes and generates bytes. You can convert any arbitrary String to bytes using one of the String.getBytes() methods (preferably the one where you define the encoding to use). The way you restrict what the plane text String contains is up to you.
    The JCE produces secure encryption based on well tested algorithms.
    The tone of your question implies that all you want to do is have a simple substitution cipher. The is very VERY VERY insecure and can be broken by a 2 year old. Use the JCE.

  • Problem in Converting Shapefile to SDO Layer

    Hi all,
    I am new to the Oracle Spatial database 10g (10.2.0.1.0). I got problem in Converting shapefile to sdo.
    My ESRI Shapefile (Tempshp.shp,Tempshp.shx,Tempshp.dbf) contain field name as "LEVEL".
    I can able to run the shp2sdo and "Tempshp.sql" and "Tempshp.ctl" files are all created without any problem.
    when i try to run the following command in SQLPlus
    @Tempshp.sql
    The following error message were generated
    LEVEL NUMBER,
    ERROR at line 4:
    ORA-00904: : invalid identifier
    May i know whats the actual problem, Is there any Reserved word/ keyword like LEVEL is present in oracle/ Spatial.
    Regards,
    Prema Selvam.
    Message was edited by:
    Prema Selvam
    Message was edited by:
    Prema Selvam

    Hello Ro,
    Thanks,
    If we are changing the field name LEVEL to Something like LEVELX, then whether we need to change the the LEVEL as LEVELX in .ctl also.
    If i am changing the Field name whether it will affect the spatial function such as join, etc..,
    Thanks & Regards,
    Prema Selvam.

  • Problem in converting reports  to PDF format - bug

    dear all,
    There is a problem in converting the reports in PDF format.
    The situation is that if we use the tool bar icon in SAP B1 to get the reports in PDF format, there are printing errors. The output PDF file does not contain the exact data that is in the report, the values are getting interchanged and mismatched.
    But if we do the same using the print in the PDF option in choose from printers window as we do regular pringting, the document is printed properly.
    what may be the cause for this bug like thing. How can we solve it??
    please help me..
    thanks and regards,
    Yeshwanth Prakash

    Check this SAP Note: 1089388     Incorrect value in exported PDF when Concat function is used
    [https://websmp130.sap-ag.de/sap(bD1lbiZjPTAwMQ==)/bc/bsp/spn/smb_searchnotes/display.htm?note_langu=E&note_numm=1089388]

Maybe you are looking for

  • G/L Accounts in Goods Receipt PO and AP Invoice

    Hi Experts I created purchase order and i want to receive the order based on the P.O but for a segmented account. i have picked the g/l account in the form settings window and the account has dropped into the goods receipt PO document. when i add the

  • Am I the only one around here who's got the the spinning wheel in Finder window when trying to upload or selecting file?

    Let's say when i try to upload something onto a website using safari, when then Finder window opened up, I have like 70% chance encounter the "spinning wheel" in the left coner, the search progress takes about 10 seconds to complete. This is very ann

  • Thumping noise when using CD's

    My Mac G5 is brand new (1 week). While installing Adobe CS2 (legit copy from Adobe) the CD was making a loud thumping noise in the drive. I've never heard this before. It was like a little man was inside and pounding the walls trying to get out. Is t

  • Out of control thread

    Is there any way to close an out of control thread so that posters can respond to current and applicable problems? Perhaps tell them to post new topics instead of continuing that one? On the Using Your MBP forum, there is a thread that is so long and

  • Shutdown with no reason!!

    i was working on my macbook pro and it shutdown for no reasoned, no warring message. the power cord was more hot than usual. When i restart my computer  the time was rest in 2000. i had reprove some only permission. google chrome don't let me surf th