Note that there are some explanatory texts on larger screens.

plurals
  1. POSpecial characters handling in Java String
    primarykey
    data
    text
    <p>i've to retrive this [type of] string from a website :</p> <pre><code>{"title":"En Loz\u00e8re, les entreprises sont incit\u00e9es \u00e0 passer \u00e0 la fibre","author":"Fran\u00e7ois Le Gall","date":... </code></pre> <p>I'd like to have an object like this :</p> <pre><code>myObject{ String title = "En Lozère, les entreprises sont incitées à passer à la fibre"; String author = "François le Gall"; ... } </code></pre> <p>This is the way i retrieve my String in java :</p> <pre><code>String myJsonString = ""; try{ URLConnection conn = new URL("http://www.ariase.com/webservices/getArticle.php?id=3019").openConnection(); InputStream in = conn.getInputStream(); Scanner s = new Scanner(in); s.useDelimiter("\\A"); while (s.hasNext()) myJsonString += s.next(); s.close(); in.close(); } catch(SocketTimeoutException e) { e.printStackTrace(); } catch(IOException e) { e.printStackTrace(); } RssJsonObject myParsedJsonObject = RssJsonObject.parseJson(myJsonString); </code></pre> <p>It's a Json Object i have to parse, no problem, but i've this specials characters like <code>\u00e0</code> which i don't know how to replace...</p> <p>I can do a dozens of <code>replaceAll("\u00e0", "à");</code> but, is there any pre-build function to do that?</p> <p>I can also edit the php page wich send me this string, maybe i've forgotten any <code>url_encode</code> or something, i'm pretty bad at php.</p> <p>This is my php code :</p> <pre><code>$query = "SELECT * FROM SITE.rssitem WHERE NEWSID = '".$newsId."'"; $eligibiliteDB-&gt;request($query); $answer = $eligibiliteDB-&gt;first(); $tab = array( "title" =&gt; strip_tags($answer['TITLE']), "author" =&gt; strip_tags($answer['AUTHOR']), "date" =&gt; strip_tags($answer['DATE']), "img" =&gt; strip_tags("http://www.ariase.com/fr/news".$answer['MINIATURE']), "description" =&gt; strip_tags($answer['DESCRIPTION']), "content" =&gt; strip_tags($answer['FULLDESCRIPTION'].' '.$answer['CONCLUSION']) ); echo json_encode($tab); </code></pre> <p>EDIT :</p> <p>My Java code above.</p> <p>I don't know if my mistakes come from the java or the php part. And i'm knew with all this encoding stuff, don't understand it very well, just know that i don't want to see <code>\u00e8</code> but 'è' in my application! :)</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload