How To Convert A unicode String into Chareter

Hi I have a fild in my database which contains string in unicode like \u0054\u0023\u4500 and so on.
My problem is that when i getting data from the db column and store itinto a string instead of showing the crossponding character, it sowing the string like written above i.e.(\u0054\u0023\u4500). Can Any Body help me
code is here..
     while(rs.next()){
          s1 += rs.getInt(1);     
     System.out.println(" " +s1);                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

Very Very Thanks to the last Thread ID Reference B c'z the last one works
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;
* @author neeraj shandilya
* @version 1.0
public class Test {
public static void main(String[] args) {
try {
     Class.forName("com.mysql.jdbc.Driver").newInstance();
     Connection con = DriverManager.getConnection("jdbc:mysql://192.168.0.160/neeraj","root","root");
     Statement st = con.createStatement();
               ResultSet rs = st.executeQuery("select * from loginmaster");
               while(rs.next()){
                    System.out.println(loadConvert(rs.getString(2)));
               con.close();
     } catch (Exception ex) {System.out.println(ex); }
* Function Which Conver
* A uni-code String to
* Charecter-String
* Don't Make Any
* Modification to the
* Code Bellow
static String loadConvert(String theString) {
char aChar;
int len = theString.length();
StringBuffer outBuffer = new StringBuffer(len);
for (int x=0; x<len; ) {
aChar = theString.charAt(x++);
if (aChar == '\\') {
aChar = theString.charAt(x++);
if (aChar == 'u') {
// Read the xxxx
int value=0;
          for (int i=0; i<4; i++) {
          aChar = theString.charAt(x++);
          switch (aChar) {
          case '0': case '1': case '2': case '3': case '4':
          case '5': case '6': case '7': case '8': case '9':
          value = (value << 4) + aChar - '0';
               break;
               case 'a': case 'b': case 'c':
case 'd': case 'e': case 'f':
               value = (value << 4) + 10 + aChar - 'a';
               break;
               case 'A': case 'B': case 'C':
case 'D': case 'E': case 'F':
               value = (value << 4) + 10 + aChar - 'A';
               break;
               default:
throw new IllegalArgumentException(
"Malformed \\uxxxx encoding.");
outBuffer.append((char)value);
} else {
if (aChar == 't') aChar = '\t';
else if (aChar == 'r') aChar = '\r';
else if (aChar == 'n') aChar = '\n';
else if (aChar == 'f') aChar = '\f';
outBuffer.append(aChar);
} else
outBuffer.append(aChar);
return outBuffer.toString();
Edited by: Neeraj Shandilya on Jan 29, 2008 2:34 PM

Similar Messages

  • How to convert non-unicode app into unicode ASO app

    I am using hyperion 11.1.1
    I would like to convert ASOsamp app into unicode app. can someone give me some direction. I have looked into DBAG but couldnt find anything useful.
    thanks in advance.

    thanks John,
    Also i would like to know about the Alias table in multiple language ? In Samp_U i see *.alt files on the server, how do we create that ? and then how do we view using those alias table. I set the Japanese alias table as active on the Samp_U database...and i was trying to view the retrieve in Japanese in Web Analysis but it didn't work. What wrong am I doing ?
    thanks for the help again.

  • How to convert an int variable into String type

    hi everybody
    i want to know how to convert an interger variable into string variable
    i have to implement a code which goes like this
    Chioce ch;
    for(int i=0;i<32;i++)
    // here i need a code to convert the int variable i into a string variable
    ch.add(String variable);
    how do i convert that int variable i into a String type variable??
    can anyone help me?

    Different methods:
    int a;
    string s=a+"";or
    String.valueOf(int) is the better option because Int.toString() generated an intermediate object to get the endresult
    Ema

  • How to convert data from rows into columns

    Hi,
    I have a sql table and the data looks like this
    GLYEAR GLMN01 GLMN02 GLMN03 GLMN04
    2007 -109712.40 6909.15 4758.72 56.88
    2007 -13411.32 19132.9 -5585.07 4362.64
    Where GLyear reprsents Year and GLMN01 is February, GLMN02 is March and so on,
    Now i want my output to be something like this which i want to insert into another table
    GLYear GLMonth GLAmount
    2007 February -109712.40
    2007 March 6909.15
    2007 April 56.88
    My new table has 3 columns, GLYear,GLMonth,GLAmount.
    Can someone please help me with the select statement on how to do this, i can work with the inserts.
    Thanks.

    I want you to check these form tread they have the same discussion as you.  They will definitely solve your problem
    http://blog.jontav.com/post/8344518585/convert-rows-to-columns-columns-to-rows-in-sql-server
    http://dba.stackexchange.com/questions/19057/convert-rows-to-columns-using-pivot-in-sql-server-when-columns-are-string-data
    http://stackoverflow.com/questions/18612326/how-to-convert-multiple-row-data-into-column-data-in-sql-server
    I hope this helps you in solving your problem. 
    Please remember to click “Mark as Answer” on the post that has answered your question as it is very relevant to other community members dealing with same problem in seeking the right answer

  • Is there an easy way to convert a long string into an array?

    I can convert a long string into a 1-d array by parsing and using build array, but I would like to know if there is a function to make this easier.
    For example:
    from/   aaaaaaaabbbbbbbbccccccccdddddddd         (string of ascii)
    to/       an array that is 1-d with each element having eight characters
              aaaaaaaa
              bbbbbbbb
              cccccccc
              dddddddd
    Thank you.
    Solved!
    Go to Solution.

    Try something like this:
    (If you can guarantee that the string length is an integer multiple of 8, you an drop the two triangular modes in the upper left. )
    Message Edited by altenbach on 03-14-2010 06:40 PM
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    ChopString.png ‏9 KB

  • How to convert a PDF file into a full editable WORD file?

    Hi,
    I tried to convert a pdf file into word but it is not fully editable. I can edit the title from the main page and that's it. The rest of the word document is saved as image. I tried editing teh pdf file but that one is not working either.
    Please help on how to convert a PDF file into a full editable WORD file.
    Thank you

    Not all PDF files are created equal.  When a PDF file is created with Adobe Tools it is usually "tagged" with information about the fonts the images, the layout etc...    This way when the PDF is saved to a new format like PPT or DOC then the results are usually usable.  However, if you have a PDF file that was not tagged for some reason then run the Accessibility tools on the PDF to acquire some basic tagging.  This may get you a better result.  Also if you have a PDF that is an image, then you may want to run OCR on it.

  • How to convert my MM alias into an AppleID to use it with iCloud?

    I used MobileMe and created a mail that became my Apple ID. Then I created an alias that became my main e-mail so now with iCloud I wish that aslias could become my Apple ID. I don't care to loose the first Apple ID but "How to convert my MM alias into an AppleID to use it with iCloud?"

    You cannot convert an alias to Apple ID.
    You can transfer your MM to iCloud with your main Apple ID.
    There will be your alias as well.
    Regards

  • Converting a binary string into a JPEG image in Crystal Reports 2008

    Hi Gang
    Iu2019m having problems converting a binary string into an image in Crystal Reports 2008
    I have JPEG images stored in ECC.  ECC stores the data in binary format.
    Iu2019m using the ECC function module SKWF_PHIO_CONTENT_ACCESS_GET to retrieve the data.  This function module has an export table, FILE_CONTENT_BINARY, which returns several lines of data.  Each line contains a maximum of 1,024 characters.
    When I drop the T_ FILE_CONTENT_BINARY.LINE field into my Crystal Report detail section, I wind up with a report that displays all the lines in FILE_CONTENT_BINARY table.  (in my case, 19 lines are displayed.)
    I created a formula to collect all the data into a single string.
    whileprintingrecords;
    stringvar data:= data & {SKWF_PHIO_CONTENT_ACCESS_GET.T_FILE_CONTENT_BINARY.LINE}
    I added the formula to the detail section and itu2019s doing a great job collecting the data.
    I then inserted a picture object in the report footer, opened the format editor, navigated to the u201Cpictureu201D tab, and inserted a formula for the u201Cgraphics locationu201D.
    whileprintingrecords;
    stringvar data:=data;
    data
    My clever idea turned out to be a disappointment . . . . my picture object is blank.
    Does anyone have a solution for converting a binary string into a JPEG image?

    Save the JPEG in a format CR supports. Refer to the help file for the file types.

  • How to convert an NWDI project into a Local project?

    Hi Experts,
    Please tell me " how to convert an NWDI project into a Local project? "
    If you c

    Hi Srini
    1. Copy/Paste Webdynpro components in the new project as was suggested before
    2. Or create new project, copy _comp folder from old project to the new one. But, do not forget to update .dcdef & .project files manually after this. You have to set the correct project name in .dcdef and set the correct local project path in .project.
    BR, Sergei

  • How to Convert Oracle Apps Report into XML Publisher

    Hi
    How to Convert Oracle Apps Report into XML Publisher?
    Thanks

    In Brief :
    Re: XML Publisher
    In Details :
    http://www.oracle.com/technology/products/xml-publisher/docs/XMLEBSRep.pdf

  • How to convert Binary to String?

    Hi,
    How to convert Binary to String? Thank!

    Never ceases to amaze me how many people cannot
    accept any form of criticism whatsoever. How dothey
    get through the normal day? Do they pick fightswith
    everyone who says anything to them they don'tlike?
    Was this for me????Who are you calling a psycho??

  • 2.....how to convert normal function module into remote enabled function mo

    Hi...
    2.....how to convert normal function module into remote enabled function module?
    thanks and regards,
    k.swaminath.

    Hi,
    In the attributes tab select radio button as  remote enabled instead of normal..
    u can call the remote enabled fm as...
    CALL FUNCTION <Function module> destination <destination name>
    Regards,
    Nagaraj

  • How do you turn a string into an integer?

    how do you turn a string into an integer?
    for ex, if i wanted to turn the string "5" into the integer 5, how would i do that?

    String stringNumber="5";
    try{
    int number=Integer.parseInt(stringNumber);
    }catch(NumberFormatException e){
    System.out.println("The string "+stringNumber+" must be a number!");
    }

  • I can't find this anywhere... how to convert mp3 (not music) into text without spending much $$$.

    i can't find this anywhere... how to convert mp3 (not music) into text without spending much $$$.

    function(){return A.apply(null,[this].concat($A(arguments)))}
    hope1hope2 wrote:
    i can't find this anywhere... how to convert mp3 (not music) into text without spending much $$$.
    It's very unlikely that you'l
    l find any help here; this forum is used only
    for testing purposes. Unfortunately, I cannot suggest
    another forum
    Extra line breaks kindly supplied by the software.

  • How to convert trailing minus sign into the leading minus sign

    Hi
    Can any plz tell me How to convert trailing minus sign into the leading minus sign? I mean in PI the amount filed shows like 150.00- i want to convert that into -150.00.
    Thanks
    Govinda

    Hi Shabarish,
    The code works but what if the input is something like [   10.000-] i.e. with some spaces before 10.000- and the output as per your code comes as [-     10.000]. How do we tackle such cases if there is inconsistency in data i.e. some values come as [    10.000-] i.e. spaces before the number and some values as [12.000-].
    The output of this will come as
    [-    10.000]
    [-12.000]
    How to make it as
    [-10.000]
    [-12.000]
    Regards,
    Shaibayan

Maybe you are looking for

  • How can I see/find my history?

    I was looking through my history with one of my contacts but it only goes so far as around  months back but when I checked my preferences it shows as Forever, and I have some contacts (with whom I don't speak often nor much) whose conversation histor

  • Report for the account of vendor invoices not received ?

    Hi friends; Is there a report or a transaction that would list the details (expense accounts, cost center an amounts) in the account of vendor invoices not received ? Thinks

  • To set a Tolerance limit in a Purchase order, for quantity variance.

    Hi , I am looking for an option to have a tolerance limit set in a PO to check the quantity variance. Please advice. Thanks Montee

  • Can't get sound to play from my mac to Bose system

    Can anyone tell me how to get sound to play from the Macbook earphone jack into a Bose system? I have the adapter plugged into the Bose as directed by Bose so it is set up but won't play. Thanks

  • Best Uncompressed for HDV 50i?

    Hi there, I did a video in FCS2, its an HDV 50i project and I have to deliver in the best quality possible for computer, its to be reedit, what settings should I use?? Cheers Javier