I get a sites source code by Java and assign it to a string. But when i see content of that string there ara ? instead of ç,ş,İ,ğ. Hope you can help me.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
DataInputStream.readLineis capable of reading latin1-encoded text only. The characters you want are not in latin1 so the page must have some different encoding, such as UTF-8.Assuming the page is encoded in UTF-8 you can read it if you substitute the part where you declare and initialize the variable
inwith the following:If you don’t know the page encoding beforehand you may be able to use the
URLConnection.getContentEncoding()method to find out. This method returns the encoding declared i the HTTP headerContent-Type. If the content type does not have the encoding you just have to guess.