projects
/
pnews.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
3277625
)
sanity fixes about the encodingY
author
Jean-Philippe Orsini
<orsinije@fr.ibm.com>
Mon, 16 Oct 2017 15:16:06 +0000
(17:16 +0200)
committer
Jean-Philippe Orsini
<orsinije@fr.ibm.com>
Mon, 16 Oct 2017 15:16:06 +0000
(17:16 +0200)
war/src/main/java/pnews/Category.java
patch
|
blob
|
history
war/src/main/java/pnews/servlet/ArticleProvider.java
patch
|
blob
|
history
war/src/main/java/pnews/servlet/Pnews.java
patch
|
blob
|
history
diff --git
a/war/src/main/java/pnews/Category.java
b/war/src/main/java/pnews/Category.java
index
7a8106f
..
2d50c06
100644
(file)
--- a/
war/src/main/java/pnews/Category.java
+++ b/
war/src/main/java/pnews/Category.java
@@
-5,6
+5,7
@@
public enum Category {
FRANCE("france"),
SPORT("sport"),
EUROPE("europe"),
FRANCE("france"),
SPORT("sport"),
EUROPE("europe"),
+ MONDE("monde"),
ECO("eco"),
ESSONNE("essonne"),
TECHNOLOGIE("technologie"),
ECO("eco"),
ESSONNE("essonne"),
TECHNOLOGIE("technologie"),
diff --git
a/war/src/main/java/pnews/servlet/ArticleProvider.java
b/war/src/main/java/pnews/servlet/ArticleProvider.java
index
9095526
..
aae0c87
100644
(file)
--- a/
war/src/main/java/pnews/servlet/ArticleProvider.java
+++ b/
war/src/main/java/pnews/servlet/ArticleProvider.java
@@
-18,13
+18,13
@@
import java.util.logging.Level;
import java.util.logging.Logger;
import org.jsoup.Jsoup;
import java.util.logging.Logger;
import org.jsoup.Jsoup;
-import org.xml.sax.InputSource;
import com.rometools.rome.feed.synd.SyndEnclosure;
import com.rometools.rome.feed.synd.SyndEntry;
import com.rometools.rome.feed.synd.SyndFeed;
import com.rometools.rome.io.FeedException;
import com.rometools.rome.io.SyndFeedInput;
import com.rometools.rome.feed.synd.SyndEnclosure;
import com.rometools.rome.feed.synd.SyndEntry;
import com.rometools.rome.feed.synd.SyndFeed;
import com.rometools.rome.io.FeedException;
import com.rometools.rome.io.SyndFeedInput;
+import com.rometools.rome.io.XmlReader;
import pnews.Article;
import pnews.Category;
import pnews.Article;
import pnews.Category;
@@
-41,10
+41,13
@@
public class ArticleProvider {
}
private static SyndFeed getSyndFeed(String u) throws IllegalArgumentException, FeedException, MalformedURLException, IOException {
}
private static SyndFeed getSyndFeed(String u) throws IllegalArgumentException, FeedException, MalformedURLException, IOException {
- InputStream is = new URL(u).openConnection().getInputStream();
- InputSource source = new InputSource(is);
-
- return new SyndFeedInput().build(source);
+ InputStream is;
+ XmlReader r;
+
+ r = new XmlReader(new URL(u));
+ XmlReader.setDefaultEncoding("UTF-8");
+
+ return new SyndFeedInput().build(r);
}
}
@@
-56,7
+59,6
@@
public class ArticleProvider {
result.put(Category.TOP,
new String[] {
"http://www.francetvinfo.fr/titres.rss",
result.put(Category.TOP,
new String[] {
"http://www.francetvinfo.fr/titres.rss",
- "http://www.france24.com/fr/actualites/rss",
"http://www.rfi.fr/general/rss",
"http://www.cnews.fr/rss/une",
"http://www.ladepeche.fr/rss/a-la-une.rss",
"http://www.rfi.fr/general/rss",
"http://www.cnews.fr/rss/une",
"http://www.ladepeche.fr/rss/a-la-une.rss",
@@
-74,6
+76,10
@@
public class ArticleProvider {
result.put(Category.EUROPE,
new String[] { "http://www.france24.com/fr/europe/rss" });
result.put(Category.EUROPE,
new String[] { "http://www.france24.com/fr/europe/rss" });
+
+ result.put(Category.MONDE,
+ new String[] { "http://www.france24.com/fr/actualites/rss" });
+
result.put(Category.ECO,
new String[] { "http://www.france24.com/fr/economie/rss",
result.put(Category.ECO,
new String[] { "http://www.france24.com/fr/economie/rss",
@@
-121,7
+127,7
@@
public class ArticleProvider {
}
if (thumbnail == null)
thumbnail = feedImage;
}
if (thumbnail == null)
thumbnail = feedImage;
-
+
title = entry.getTitle().trim();
if (entry.getDescription() != null) {
title = entry.getTitle().trim();
if (entry.getDescription() != null) {
diff --git
a/war/src/main/java/pnews/servlet/Pnews.java
b/war/src/main/java/pnews/servlet/Pnews.java
index
662b47c
..
8a98571
100644
(file)
--- a/
war/src/main/java/pnews/servlet/Pnews.java
+++ b/
war/src/main/java/pnews/servlet/Pnews.java
@@
-89,6
+89,7
@@
public class Pnews extends HttpServlet {
html = HTML.toHTML(articles, cat);
rp.setContentType("text/html");
rp.getWriter().write(html);
html = HTML.toHTML(articles, cat);
rp.setContentType("text/html");
rp.getWriter().write(html);
+ rp.setCharacterEncoding("UTF-8");
} else {
LOG.severe("writeArticles cannot retrieve any articles");
html = HTML.toHTML(new ArrayList<Article>(), cat);
} else {
LOG.severe("writeArticles cannot retrieve any articles");
html = HTML.toHTML(new ArrayList<Article>(), cat);