Problem in String reading

I'm trying to read
�r�nler aras�nda k�yaslama yapmak i�in se�iniz
what i get is
�?r��nler aras��nda k��yaslama yapmak i��in se��iniz
I am using String class to read it using URL class from a turkish website using the following code
String pagedata="";
String s="":
URL u = new URL(link);
     InputStream is = u.openStream();
     DataInputStream dis = new DataInputStream(new BufferedInputStream(is));
     while ((s = dis.readLine()) != null) {
     pagedata=pagedata+"\n"+s;
What is the possible solution of this problem?

Well, you aren't using the String class to read anything there. You are using a DataInputStream and a BufferedInputStream to read it. And you letting the DataInputStream convert the bytes to chars using your system's default encoding.
I have no idea why you would choose to use a DataInputStream to read text from a web page. To read text you should be using a Reader of some sort. Here's a replacement line:BufferedReader dis = new BufferedReader (new InputStreamReader(is, "XXXXXX"));You should replace the XXXXXX in that example by the actual charset of the page. My guess based on what you posted is that it's UTF-8, but look in the HTML for a <meta> tag that declares the page's charset.

Similar Messages

  • Problem with String variable

    I am new to Java Programming.
    I have a line of code that works and does what is supposed to.
    faceData.getProfile("Lisa").removeFriend("Curtis");
    If I assign the strings to variables such as-
    String name = "Lisa";
    String fName = "Curtis";
    and then plug those into the same line of code, it does not work
    faceData.getProfile(name).removeFriend(fName);
    What could be causing the problem?
    I even added some lines to print out what is stored in the variables to verify that they are what they should be, but for some reason the variables do not work while putting the strings in quotes does. Any ideas?

    I guarantee that something about your assertions are incorrect. Those variables are either not equal to the values you claim, or something else is going on. But it's not a problem with string variables versus string constants.
    Edit: My best guess in lack of a real example from you, is that the strings in question have non-printable characters in them, such as trailing spaces or line feeds.

  • Little problem with Strings.

              I have an little problem with Strings, i make one comparision like this.
              String nombre="Javier";
              if( nombre.equalsIgnoreCase(output.getStringValue("CN_NOMBRESf",null)) )
              Wich output.getStringValue("CN_NOMBRESf",null) is "Javier" too, because I display
              this before and are equals.
              What I do wrong?.
              

    You are actually making your users key in things like
    "\026"? Not very user-friendly, I would say. But
    assuming that is the best way for you to get your
    input, or if it's just you doing the input, the way to
    change that 4-character string into the single
    character that Java represents by '\026', you would
    use a bit of code like this:char encoded =
    (char)Integer.parseInt(substring(inputString, 1),
    16);
    DrClap has the right idea, except '\026' is octal, not hex. So change the radix from 16 to 8. Unicode is usually represented like '\u002A'. So it looks like you want:String s = "\\077";
    System.out.println((char)Integer.parseInt(s.substring(1), 8));Now all you have to do is parse through the String and replace them, which I think shouldn't be too hard for you now :)

  • Problem with String to Int conversion

    Dear Friends,
    Problem with String to Int conversion
    I am having a column where most of the values are numeric. Only 4 values are non numeric.
    I have replaces those non numeric values to numeric in order to maintain the data type.
    CASE Grade.Grade  WHEN 'E4' THEN '24'  WHEN 'E3' THEN '23'  WHEN 'E2' THEN '22' WHEN 'E1' THEN '21' ELSE Grade.Grade  END
    This comes the result as down
    Grade
    _0_
    _1_
    _10_
    _11_
    _12_
    _13_
    _14_
    _15_
    _16_
    _17_
    _18_
    _19_
    _2_
    _20_
    _21_
    _22_
    _23_
    _24_
    _3_
    _4_
    _5_
    _6_
    _7_
    _8_
    _9_
    Refresh
    Now I want to convert this value to numeric and do some calculation
    So I changed the formula as below
    cast (CASE Grade.Grade  WHEN 'E4' THEN '24'  WHEN 'E3' THEN '23'  WHEN 'E2' THEN '22' WHEN 'E1' THEN '21' ELSE Grade.Grade  END as INT)
    Now I get the following error
    View Display Error
    _     Odbc driver returned an error (SQLExecDirectW)._
    Error Details
    Error Codes: OPR4ONWY:U9IM8TAC:OI2DL65P
    _State: HY000. Code: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error has occurred. [nQSError: 17001] Oracle Error code: 1722, message: ORA-01722: invalid number at OCI call OCIStmtFetch. [nQSError: 17012] Bulk fetch failed. (HY000)_
    SQL Issued: SELECT cast ( CASE Grade.Grade WHEN 'E4' THEN '24' WHEN 'E3' THEN '23' WHEN 'E2' THEN '22' WHEN 'E1' THEN '21' ELSE Grade.Grade END as Int) saw0 FROM "Human Capital - Manpower Costing" WHERE LENGTH(CASE Grade.Grade WHEN 'E1' THEN '20' WHEN 'E2' THEN '21' WHEN 'E3' THEN '22' WHEN 'E4' THEN '23' ELSE Grade.Grade END) > 0 ORDER BY saw_0_
    Refresh
    Could anybody help me
    Regards
    Mustafa
    Edited by: Musnet on Jun 29, 2010 5:42 AM
    Edited by: Musnet on Jun 29, 2010 6:48 AM

    Dear Kart,
    This give me another hint, Yes you are right. There was one row which returns neither blank nor any value.
    I have done the code like following and it works fine
    Thanks again for your support
    Regards
    Code: cast (CASE (CASE WHEN Length(Grade.Grade)=0 THEN '--' ELSE Grade.Grade END) WHEN 'E4' THEN '24' WHEN 'E3' THEN '23' WHEN 'E2' THEN '22' WHEN 'E1' THEN '21' when '--' then '-1' ELSE Grade.Grade END as Int)

  • Problems declaring string array.

    I am having a problem declaring string arrays in a class that I am writing now. For some reason this code won't work:
    public class rotors()
    String[] rotor = new String[5];
    rotor [0] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
    rotor [1] = "ACEGIKMOQSUWYBDFHJLNPRTVXZ";
    rotor [2] = "BDFHJLNPRTVXZACEGIKMOQSUWY";
    rotor [3] = "AEIOUYBCDFGHJKLMNPQRSTVWXZ";
    rotor [4] = "BCDFGHJKLMNPQRSTVWXZAEIOUY";
    }//end rotorsOn the other hand, this code will:
    public class rotors()
    String[] rotor={"ABCDEFGHIJKLMNOPQRSTUVWXYZ","ACEGIKMOQSUWYBDFHJLNPRTVXZ","BDFHJLNPRTVXZACEGIKMOQSUWY", "AEIOUYBCDFGHJKLMNPQRSTVWXZ",  "BCDFGHJKLMNPQRSTVWXZAEIOUY"};
    }//end rotorsI've noticed that the first code block that I posted will work, but only if I post it in a method, but not just hanging out in the class. Can anyone tell me why this is so? It seems odd to me that the first code doesn't work while the second one does. Thanks a lot
    Edited by: archangeleon on Oct 10, 2008 9:13 PM

    You can initialize a newly declared variable outside of a method/constructor/initializer block, but you can't call other statements outside of these blocks. The rotor array is declared here: String[] rotor... and can only be initialized (if at all) on this line.

  • Problems  with  string larger char(255)

    Hi guys ,
    Something really weird happened to me , i have the following code  to create a  flat file , suddenly it is truncating the lines in 250 ,  its funny i see  wa_ti_fich+330(5)   in the debugging and it has data , but the whole wa_ti_fich is only 255 long , ive tried with type char600 , with the same result , i cant use type string beacuse is not allow for unix file .
    data: begin of ti_fich occurs 0,
            linha(527),
          end of ti_fich .
    wa_ti_fich-linha+49(15)  = montante.
        wa_ti_fich-linha+64(2)   = '02'.   "codigo moeda 02
        wa_ti_fich-linha+106(2)  = '01'. "Codigo de la situación.
        wa_ti_fich-linha+112(8)  =  itab_saida-datav.
        wa_ti_fich-linha+120(8)  =  itab_saida-datav.
        wa_ti_fich-linha+128(8)  =  montante.
        wa_ti_fich-linha+143(2)  = '02'.
        wa_ti_fich-linha+185(2)  = '01'.  "  Naturaleza titular
        wa_ti_fich-linha+187(10) = itab_saida-stceg+2(10).
        wa_ti_fich-linha+197(1)  = '2'.    " Formato do nombre
        wa_ti_fich-linha+198(110) = itab_saida-name1.
        wa_ti_fich-linha+329(1) =  '2'.
        wa_ti_fich-linha+330(110) = itab_saida-stras.
        wa_ti_fich-linha+446(50) = itab_saida-ort01." nom_mun :
        wa_ti_fich-linha+496(2) =  itab_saida-regio.
        wa_ti_fich-linha+501(5) = itab_saida-pstlz.
    append wa_ti_fich to ti_fich .
    please don send me links for scn  or google with similar subjects because i ve already checked it , believe me .
    thank

    255 is the maximum output lengh for CHAR variables in the Old Debugger. So it is normal that you don't see the end of the string in the Old Debugger.
    If you have a newer R/3-Release you can use the New Debugger and choose the output format "Tabular". In this display format, the contents are portioned into 50 characters each and thus you'll see the complete string. In older R/3-Releases, where the New Debugger is not yet available, you will have to input manually offsets in the debugger to see the complete string.

  • Collation problem in Acrobat Reader X

    I have a collation problem with Acrobat Reader X and HP LaserJet M2727 nf (using HP Universal Printing PCL 6 driver)
    When printing multiple copies of a PDF, the result is always in the order 1,2,3 1,2,3 etc. (for a 3 page document for example)
    This is the case even when I uncheck the default collate option.
    How can I disable the collation option in this version?
    Thanks,
    Eran

    HELP!  This is a killer problem.   Everyone is banking on PDF documents and Adobe Reader.  YOU CAN NOT IGNORE THIS ANY MORE!
    There was a registry setting in Reader 8 to force host collation.. it doesn't work any more.  Please respond immediately !!!!

  • Problem with adobe reader x (10.0.1) error 1327 message. invalid drive: H:\

    I AM HAVING A PROBLEM W ADOBE READER X (10.0.1)  IT GIVES ME A ERROR 1327 MESSAGE  INVALID DRIVE: H:\
    I CAN NOT DELETE IT OR OPEN IT OR DO ANYTHING . WHEN IT TRIES TO REINSTALL IT BRINGS UP SCREEN ;
    SET UP WAS INTERRUPTED BEFORE ADOBE READER X (10.0.1) COULD BE INSTALLED. YOUR SYSTEM HAS NOT BEEN MODIFIED.

    O/P reports issue as resolved in http://forums.adobe.com/thread/1127028

  • Problem with Adobe Reader not being able to run with Maverick  10.9.2?

    problem with Adobe Reader not being able to run with Maverick  10.9.2?

    Have you updated your version of Adobe Reader?

  • Problem with Adobe Reader and IE

    I'm using Vista Home Premium and IE9 with the latest Reader available.  Starting yesterday, I cannot read PDF files on the web.  This is a new problem.  I tried to download newer versions of IE and the Reader, but both tell me I've got the newest versions I can use.
    I have no problem with Firefox.  Just IE.  I prefer using IE.  Can someone guide me -- without using technical language.  Many thanks!!

    Thanks for your input.  I opened the standalone Adobe Reader X, clicked Edit, Preferences, Security, Advanced Preferences.  Then clicked each of the 3 tabs on top, but nothing looked like "Protected Mode."
    Then I went back and clicked Security (Enhanced) and unchecked Enable Enhanced Security.  Tested this change, but I still get the gray screen and messages:  "A problem has caused IE to close."  "A problem with this website has caused IE to close and re-open the tab."  I then went back and re-checked Enable Enhanced Security.
    I should mention that I have used this particular website for about 10 years and never had a problem.  But I now have the same problem with any online PDF that I try to open using IE.
    Can you think of anything else?  If not, here's my plan of attack.  Please let me know if you think it will work.
    1)  Copy over all my favorite sites from IE to Firefox.  (I've already started doing that.)
    2)  Uninstall IE and re-install it.
    3)  If I still have a problem, uninstall Adobe Reader and re-install it.
    Do you think this will do the job if all else fails?
    Many, many thanks for the time you have put into this.

  • Problem with adobe reader, commenting

    one of our authors is using adobe reader x 11,1, and I send him a pdf (enabled commenting and measuring), but for some reason the commenting-fields does not show on his screen?
    should I save the pdf in another way?

    What do you mean by "commenting fields" exactly? By “commenting filds” I mean the tools in top of the page – delete, highlight etc. When I send the pdf, I save it as “file - save as -  reader extended pdf – enable commenting and measuring”, otherwise the commenting tools normally don’t appear by the author.
    Are they existing comments? no, it is the text in his pdf-book he needs to correct
    Is he able to access the commenting tools? no
    You can try sending a non-enabled version since Reader 11 can add comments to a non-enabled document. will try that J
    Fra: George Johnson [email protected]
    Sendt: 6. november 2012 16:16
    Til: Forlagene Idag & Nordan
    Emne: problem with adobe reader, commenting
    Re: problem with adobe reader, commenting
    created by George Johnson <http://forums.adobe.com/people/George_Johnson>  in Creating, Editing & Exporting PDFs - View the full discussion <http://forums.adobe.com/message/4826849#4826849

  • Continued problems with Adobe Reader 9.3.1

    Adobe Reader stops at the half-way mark in the progress block when loading a form to print.  Cannot get this fixed. Does anyone out there have a fix for this.  Is Adobe even recognizing that there is a problem with this.  Error message keeps telling me that there is a problem with Adobe Reader, exit and try again.

    I haven't been able to print any .pdf files since I downloaded 9.3.
    My message says Internet Explorer has closed it down because of data executable files.  I've changed my DEF settings to allow
    Adobe Reader but it still doesn't work.  I never had any problems before with newer versions.

  • Problems in Adobe Reader when I open a pdf file

    I have problems in Adobe Reader when I open a pdf file, the menu bar appears blank without options and when I pass the mouse over the bar she disappears. I uninstalled and reinstalled Adobe Reader and to no avail. Could anyone help in this case.

    Manuel Sobreira wrote:
    My version is already the most current, Kaspersky Internet Security 2015 15.0.0.463 (b).
    That is the old version that causes the problem; you need to update to the latest version (15.0.2.361).

  • Having problem with adobe reader

    Hi,
    I have a problem with adobe reader in my cell phone E71 model recently.I could open any pdf files till yesterday,but now without any reason the adobe reader icon in the office folder does not open.I wanna know what should I do.

    Might be some problem with adobe reader. You may Google another pdf app called pdf plus. Install it and see if the problem is solved or not.
    Nokia C7

  • The display problem of Adobe Reader 11.0.09

    Hi, everyone,
    My operation system is Windows XP SP3 Professional.
    I encountered a strange display problem of Adobe Reader 11.0.09.
    The problem happened not only at Adobe Reader 11.0.09 Chinese Traditional, but also English United States.
    The display problem such as two pictures as follow.
    The strange problem was that menu bar covered by toolbar items or disappeared.
    Please tell me how to resolve the problem.
    Thanks a lot.

    Thanks for your help, Ajlan huda.
    Could you tell me where I could find the system requirement about Adobe Reader patch 11.0.09?
    I couldn't find any information about system requirement of Adobe Reader patch 11.0.09.
    I knew Adobe Reader 11 could install on Windows XP SP3 just all.
    I could install and upgrade Adobe Reader to 11.0.09 as the following picture.
    I will roll back the version of Adobe Reader from 11.0.09 to 11.0.07 and test the problem appear or not.

Maybe you are looking for

  • Applying a sequence of workflows

    OK how about this anyone. You have several workflows - it's too laborious to write one big long joined up workflow - and you want to apply them in a sequence. Is there any way of doing this? Do you apply a workflow and get applescript to get the next

  • Easy Cost Planning -Costing has already been completed. No changes possible

    Hi, I am in Easy Cost Planning tool and i would like to remove some items or add in some items. The system is giving a message that "Costing has already been completed. No changes possible" May i know where did we complete the costing(Transaction cod

  • Third Party App Updates....

    I was wondering if it was possible or if there was anything like Apple Software Update for third party apps. By this I mean is there a way to get all the third party installed software such as Tweetie, VLC, Quicken, iHomework, etc. to all check for u

  • Getting Older Flash Player Reinstalled

    I need to get Adobe 11.7 reinstalled. I've had nothing but problems with Chrome-based Pepper Flash Player. I installed your other 11.8 version and am having problems with it as well. Please advise as to how I can get the 11.7 version back.

  • How to create and deploy a war file on wls using the console

              my question is how to deploy the simpleSession.jsp example in the weblogic/samples/examples/jsp/           dir examples as a war file on wls cluster what are the steps to do so.. thanks           in advance