How encode unicode string like that?

Hi there, i have a problem about encode unicode string:
- The browser encode unicode string "ư?ắ?ồ" like that:
%c6%b0%c3%a0%e1%ba%af%c3%a2%e1%bb%93
- I try but i can't find the way to do like this in Java
- Anyone know how do that? Thanks.

Have a look at the URLEncoder class.

Similar Messages

  • How can i get the correct text from a string like it show in the original source with the quotation marks in the right place ?

    The text is in hebrew so the problem is that sometimes the quotation marks not in the right place.
    For example i have this text: תווית
    על בגד: ''תן לאישה לכבס. זה תפקידה''
    This is the source original text you can see the quotations marks and they are not in the right place and all i did is copy paste.
    And this is a screenshot of how this text looks like in the website in the original:
    You can see now where the quotations marks should be.
    Now this is how i'm using the text in my program:
    First of all i'm using a webclient to download the page from the website and i'm also encoding it to windows-1255 since it's in hebrew.
    using (var webClient = new WebClient())
    webClient.Headers.Add("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.0.3705;)");
    byte[] myDataBuffer = webClient.DownloadData("http://rotter.net/scoopscache.html");
    page = Encoding.GetEncoding("windows-1255").GetString(myDataBuffer);
    Then i'm extracting the places i need by reading the html file lines and parsing the right text and it's link.
    string loc;
    List<string> metas = new List<string>();
    List<string> metas1 = new List<string>();
    List<string> lockedLinks1 = new List<string>();
    string text = "";
    string mys = "";
    public List<string> LockedThreads(string filename)
    lockedThreads = new List<string>();
    lockedLinks = new List<string>();
    Regex textRegex = new Regex("ToolTip.*?(?=','<)");
    string[] fall = File.ReadAllLines(filename);
    for (int i = 0; i < fall.Length; i++)
    if (fall[i].Contains("http://rotter.net") && fall[i].Contains("locked")||
    fall[i].Contains("locked_icon_general") ||
    fall[i].Contains("locked_icon_anchor") ||
    fall[i].Contains("icon_anchor") ||
    fall[i].Contains("locked_icon_fire") ||
    fall[i].Contains("locked_icon_sport") ||
    fall[i].Contains("locked_icon_camera") ||
    fall[i].Contains("locked_icon_movie"))
    Regex linkParser = new Regex(@"\b(?:https?://|www\.)\S+\b", RegexOptions.Compiled | RegexOptions.IgnoreCase);
    foreach (Match m in linkParser.Matches(fall[i + 2]))
    if (m.Value.Contains("><b"))
    loc = m.Value.Replace("\"><b", string.Empty);
    lockedLinks.Add(loc);
    string txt = fall[i - 1];
    string text = textRegex.Match(txt).Value.Replace("ToolTip','", String.Empty);
    if (text.Contains("&rsquo;"))
    text = text.Replace("&rsquo;", string.Empty);
    lockedThreads.Add(text);
    Already here on the List lockedThreads you can see the quotation marks not in the right place as in the original:
    After i'm parsing the text and links and adding them to the Lists in another class i'm doing a comparison using this Lists:
    foreach (List<string> l_branch in ListsExtractions.responsers)
    TreeNode l_node = treeView1.Nodes.Add(l_branch[l_branch.Count - 1]);
    if (ListsExtractions.lockedThreads.Contains(l_node.Text))
    l_node.ImageIndex = 0;
    l_node.SelectedImageIndex = 0;
    for (int l_count = 0; l_count < l_branch.Count - 1; l_count++)
    TreeNode l_subnode = l_node.Nodes.Add(l_branch[l_count]);
    if (ListsExtractions.lockedThreads.Contains(l_subnode.Text))
    l_subnode.ImageIndex = 0;
    l_subnode.SelectedImageIndex = 0;
    The problem is in the line:
    if (ListsExtractions.lockedThreads.Contains(l_node.Text))
    When it's getting to the line with the quotation marks it's never equal.
    Now there are more quotation marks.
    In general the problem when comparing both text if it's having quotation marks it's not the same.
    So i have two options:
    1. To fix it somehow so the quotation marks will be the same in both variables when comparing and also the same like in the original as they show in the html page.
    2. To remove the quotation marks from both variables.
    What should i do ? And how ? I was prefer to use the original quotation marks like in the original since they have a meaning in the place they should be. The question is how can i do it ?
    This is example of the block from the html file where the text with the quotation marks is:
    <TD ALIGN="RIGHT" VALIGN="TOP">&nbsp;<font size=-1 color=#ff9933><b>9418</b></font>&nbsp;</TD></TR><TR BGCOLOR="#eeeeee">
    <TD ALIGN="RIGHT" VALIGN="TOP">
    <body onmousemove="overhere()">
    <a onmouseover="EnterContent('ToolTip','תווית על בגד: &rsquo;&rsquo;תן לאישה לכבס. זה תפקידה&rsquo;&rsquo;','<u><span style=color:#000099;>כתב: Spook בתאריך: 08.03.15 שעה: 22:11</span></u><br>מחאת טוויטר קמה בעקבות תוויות שוביניסטיות שהדפיסה חברת אופנה באינדונזיה לפיהן תפקיד הכביסה מוטל על האישה. החברה התנצלה אך כנראה רק עשתה רק יותר נזק לע...'); Activate();" onmouseout="deActivate()" href="javascript:void(0)">
    <img src="http://rotter.net/forum/Images/new_locked_icon_general.gif" border="0"></a></TD><TD ALIGN="right" VALIGN="TOP" WIDTH="55%">
    <FONT CLASS='text15bn'><FONT FACE="Arial">
    <a href="http://rotter.net/cgi-bin/forum/dcboard.cgi?az=read_count&om=189696&forum=scoops1"><b>
    <font color="898A8E">תווית על בגד: ''תן לאישה לכבס. זה תפקידה''</b>
    </a></font></TD>

    Ok, it is unclear on what is happening here.
    Are you saying that when the webclient gets the data that it is not honoring the quote characters? Or the processing of the data buffer is causing issues?
    This is what I see the of your example text which is trying to be parse out:
    <a onmouseover="EnterContent('ToolTip','תווית על בגד: &rsquo;&rsquo;תן לאישה לכבס. זה תפקידה&rsquo;&rsquo;','<u><span style=color:#000099;>כתב: Spook בתאריך: 08.03.15 שעה: 22:11</span></u><br>מחאת טוויטר קמה בעקבות תוויות שוביניסטיות שהדפיסה חברת אופנה באינדונזיה לפיהן תפקיד הכביסה מוטל על האישה. החברה התנצלה אך כנראה רק עשתה רק יותר נזק לע...'); Activate();">";
    It appears to me that the  escapes `&rsquo;` does not have matching `&ldquo;` anywhere within the tooltip. So it appears that the page properly places left quotes in when processing the page, but the raw html has broken text.
    Hence a garbage in, garbage out situation.
    William Wegerson (www.OmegaCoder.Com)

  • 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

  • How to escape string that SQLCMD thinks is a variable but isn't.

    Hi All,
    I've got a SQLCMD script where I use :setvar like I usually do.  As part of its work it calls a stored procedure that has a parameter whose value is a string.  Part of the string being passed looks like this. 
    Objects="$(INSTANCE)"
    Now my SQLCMD script is throwing and error like the following.
    A fatal scripting error occurred.
    Variable INSTANCE is not defined.
     How do I  escape that $(INSTANCE) inside the string that SQLCMD thinks is a variable for it to use so that the string gets loaded into the table as it supposed to be?  I'm failing to find how to escape
    a variable that isn't actually a variable.
    Joe
    Joe Moyle

    To anyone interested I was able to solve this.  In the string being passed in as a parameter I was able to replace the $ with
    +
    CHAR(36)
    +
    and it works perfectly.
    Joe Moyle

  • How to deal with query that works like dir or ls

    I just can't figure it out how to deal with query that works like dir (Win32) or ls(unix) with special character like '*' and '?' , ex. c:\> dir j*.t?t
    Could somebody please tell me?

    Here's some code for using a FileFilter for the listFiles() method of the File class:
    import java.io.*;
        FileFilter myFileFilter = new MyFileFilter("*.t?t");
        File[] files = File.listFiles(myFileFilter);
      class MyFileFilter implements FileFilter {
            private String pattern;
            public MyFileFilter(String pattern) {
                this.pattern = pattern;
            public boolean accept(File file) {
                if (file.isDirectory()) {
                    return false;
                if (file.getName() ??matches?? pattern) {
                    // you'll have to put the pattern match code here!!
                    return true;
                return false;
      }maybe someone else can help with the pattern matching!

  • Separate string like "x,y" to x and y. how ?

    Hi !
    How can I seperate string like x,y to x and y ???
    Thank you!

    Hi,
    if there is only one "," in that string, you can do it this way to
    String yourString = "first part,second part";
    int i =yourString.indexOf(",");
    String first = yourString.subString(0,i);
    String second = yourString.subString(++i);with a StringTokenizer do it this way:
    String yourString = "first part,second part";
    StringTokenizer st = new StringTokenizer(yourString,",");
    String first = st.nextToken();
    String second = st.nextToken();You see, if you have to separate more parts separated by "," the StringTokenizer would be the better choice - but that can be done also by a recursive or iterative method, which uses the first code.
    Hope this helps
    greetings Marsian

  • My iPhone 4 no longer connects to my car or alarm clock after a recent sync to my computer.  The message at I get when trying to. Connect is "this accessory is not optimized for the device" or something like that.  Anyone know how to fix this?

    My iPhone 4 no longer connects to my car or alarm clock after a recent sync to my computer.  The message at I get when trying to. Connect is "this accessory is not optimized for the device" or something like that.  Anyone know how to fix this?

    Hello there philp_69,
    If I understand correctly it sounds like your phone hasnt been recognized in iTunes on your PC since the last couple of updates. I would use the troubleshooting in the following article which will walk you through the steps one by one. 
    iPhone, iPad, or iPod touch not recognized in iTunes for Windows
    Thank you for using Apple Support Communities.
    All the very best,
    Sterling

  • How can I get apple to email me things like updates and stuff like that on email?

    How can I get apple to email me things like updates and stuff like that on email?

    You can't.

  • I was downloading an app and it wasnt downloadnig so i turned my ipod off and now its a just a black screen with the the loading circle. Its been like that for 10 hours. How do i get back to my home screen?

    I was downloading an app and it wasnt downloadnig so i turned my ipod off and now its a just a black screen with the the loading circle. Its been like that for 10 hours. How do i get back to my home screen? or how do i get the litle loading circle to go away.. it wont even load into itunes

    Try:
    - iOS: Not responding or does not turn on
    - Also try DFU mode after try recovery mode
    How to put iPod touch / iPhone into DFU mode « Karthik's scribblings
    - If not successful and you can't fully turn the iOS device fully off, let the battery fully drain. After charging for an least an hour try the above again.
    - If still not successful that usually indicates a hardware problem and an appointment at the Genius Bar of an Apple store is in order.
    Apple Retail Store - Genius Bar       

  • When I plug my ipod in I am able to add song to it but the tab that says "on this ipod" no longer shows up so I cannot remove things from my ipod or anything like that. How do I change this weird setting?

    When I plug my ipod in I am able to add song to it but the tab that says "on this ipod" no longer shows up so I cannot remove things from my ipod or anything like that. How do I change this weird setting? On other computers this shows up fine so it is clearly a problem with itunes and not my ipod.

  • My laptop got formatted and so did all my itunes information like music, contacts, and games. So how can I get all that back because if I just plug my iPhone into the laptop all my stuuf that was on my phone will be gone? help please

    My laptop got formatted and so did all my itunes information like music, contacts, and games. So how can I get all that back because if I just plug my iPhone into the laptop all my stuuf that was on my phone will be gone? help please

    http://www.wideanglesoftware.com/touchcopy/index.php

  • I used utilities to source my 10.6 snow leopard install disc to my main hardrive, and now when I turn on my computer the apple with the spinning wheel stays on the screen and stuck like that. How do I fix it Help please. I already tried all the commands

    I used utilities to source my 10.6 snow leopard install disc to my main hardrive, and now when I turn on my computer the apple with the spinning wheel stays on the screen and stuck like that. How do I fix it Help please. I already tried all the commands such as Command R, Holding down the Option key, C and holding down shift at the start up but nothing happens.
    initialy All I was trying to do was downgrade 10.7 to 10.6 .

    You have to consider the possibility the hard drive may be dying.    If your data isn't backed up, try one of the tools below:
    https://discussions.apple.com/docs/DOC-1689
    Once you are sure your data is backed up, we can examine other possibilities.  In the meantime call AppleCare for your original installation DVDs.  You may need them.

  • HT1727 My old computer died on me with no warning signs. I didn't know or need to copy my music to another computer. I would like to know how to get the music that I bought onto my new computer without having to buy it all again.

    My old computer died on me with no warning signs. I didn't know or need to copy my music to another computer. I would like to know how to get the music that I bought onto my new computer without having to buy it all again. I just want to be able to get all of my music that I bought on itunes onto my computer. Right now the money ive spent is just gone and I have no music to show for it.

    Go to the iTunes Store and select "Purchased" from the Quick Links side bar on the right. Go through all the tabs to download again for free

  • How can I query and retrieve like that?

    Hi all!
    When I read the tuning document of company, I found that some retrieved information about storages and machine. Because this forum does not allow to post message with attach file, so I demonstrate like that:
    Disk Device Disk Utilization (%) Disk Reads (per second) Disk Writes (per second) ...
    C: 0.02 0.0024 1.46
    Where and how can I retrieve this record? What dynamic view do I retrieve?
    Thanks any way

    SQL> r
    1 select substr(NAME,1,4),
    2 sum(PHYRDS) "Physical Reads",
    3 sum(round((PHYRDS / PD.PHYS_READS)*100,2)) "Read %",
    4 sum(PHYWRTS) "Physical Writes",
    5 sum(round(PHYWRTS * 100 / PD.PHYS_WRTS,2)) "Write %",
    6 sum(fs.PHYBLKRD+FS.PHYBLKWRT) "Total Block I/O's"
    7 from (
    8 select sum(PHYRDS) PHYS_READS,
    9 sum(PHYWRTS) PHYS_WRTS
    10 from v$filestat
    11 ) pd,
    12 v$datafile df,
    13 v$filestat fs
    14 where df.FILE# = fs.FILE#
    15* group by substr(name,1,4)
    SUBS Physical Reads Read % Physical Writes Write % Total Block I/O's
    /u01 9424 99.29 11093 94.17 33569
    /u02 0 0 7 .06 7
    /u03 68 .72 680 5.77 939

  • My free apps purchased using my cousin's apple id won't open anymore on my iphone but apps donwloaded using my own apple id still works. Why is it like that and how can I make apps purchased using my cousin's apple id work on my iphone? Help!

    My free apps purchased using my cousin's apple id won't open anymore on my iphone but apps donwloaded using my own apple id still works. Why is it like that and how can I make apps purchased using my cousin's apple id work on my iphone? Help!

    Welcome to the Apple Community.
    Delete the apps purchased by your cousin and purchase your own.

Maybe you are looking for

  • When Photoshop CS6 is invoked from PSE 11 Organizer why is a new file created with _edited-1 appende

    I just converted a large PSE 10 catalog to work with a downloaded trial version of PSE 11.  When I brought up the Organizer and clicked on the Editor button I selected Photoshop CS 6.  At that point the Organizer created an image stack with a new fil

  • W700 - Random, frequent. Black Screen of Death

    Hello,  I have a W700 that I acquired in june 2010 and that I enjoyed very much until the beginning of this summer.  Gradually I started to get black screens of death, no cursor, no response, no solution but to hard reset the computer. At first it wa

  • Gnome 3 sound. Blowing my ears off -.-

    I just updated to banshee 2.2, which apparently changes the audio settings so that the slider bar for audio affects the entire system,  and now I fear blowing my ears off.  It only takes a few notches for the audio to feel like listening to an ipod a

  • Update methode in model-view-controller-pattern doesn't work!

    I'm writing a program in Java which contains several classes. It must be possible to produce an array random which contains Human-objects and the Humans all have a date. In the program it must be possible to set the length of the array (the number of

  • Query - Page Fragments and Page Definitions

    Hello I am trying to use JSFF (fragments). I created one fragment and created fields on it. It created its own page definition file with all the binding information. I then included it inside a JSF page and am trying to run it. I am getting an except