List of usage examples for org.apache.commons.lang3 StringEscapeUtils unescapeHtml4
public static final String unescapeHtml4(final String input)
Unescapes a string containing entity escapes to a string containing the actual Unicode characters corresponding to the escapes.
From source file:joliex.util.HTMLUtils.java
public String unescapeHTML(String s) { return StringEscapeUtils.unescapeHtml4(s); }
From source file:com.aistor.modules.cms.service.SiteService.java
@Transactional(readOnly = false) public void save(Site site) { if (site.getCopyright() != null) { site.setCopyright(StringEscapeUtils.unescapeHtml4(site.getCopyright())); }//from w w w. jav a2 s. c om siteDao.save(site); CmsUtils.removeCache("site_" + site.getId()); CmsUtils.removeCache("siteList"); }
From source file:com.nhncorp.lucy.security.xss.XssPreventer.java
/** * ? XssPreventer ? ? ? . <br/> * /*w w w. j a va 2 s . co m*/ * @param clean * XssPreventer ?. * @return XssPreventer ? ?. */ public static String unescape(String clean) { String str = StringEscapeUtils.unescapeHtml4(clean); if (str == null) { return null; } Matcher matcher = unescapePttern.matcher(str); if (matcher.find()) { return matcher.replaceAll("'"); } return str; }
From source file:com.ryan.ryanreader.fragments.PostPropertiesDialog.java
@Override protected void prepare(Context context, LinearLayout items) { final RedditPost post = getArguments().getParcelable("post"); items.addView(//from w ww. j ava2 s . co m propView(context, R.string.props_title, StringEscapeUtils.unescapeHtml4(post.title.trim()), true)); items.addView(propView(context, R.string.props_author, post.author, false)); items.addView(propView(context, R.string.props_url, post.url, false)); items.addView(propView(context, R.string.props_created, RRTime.formatDateTime(post.created_utc * 1000, context), false)); if (post.edited instanceof Long) { items.addView(propView(context, R.string.props_edited, RRTime.formatDateTime((Long) post.edited * 1000, context), false)); } else { items.addView(propView(context, R.string.props_edited, R.string.props_never, false)); } items.addView(propView(context, R.string.props_subreddit, post.subreddit, false)); items.addView(propView( context, R.string.props_score, String.format("%d (%d %s, %d %s)", post.score, post.ups, context.getString(R.string.props_up), post.downs, context.getString(R.string.props_down)), false)); items.addView(propView(context, R.string.props_num_comments, String.valueOf(post.num_comments), false)); if (post.selftext != null && post.selftext.length() > 0) { items.addView(propView(context, R.string.props_self_markdown, post.selftext, false)); } }
From source file:com.funtl.framework.smoke.core.modules.gen.service.GenTemplateService.java
@Transactional(readOnly = false) public void save(GenTemplate genTemplate) { if (genTemplate.getContent() != null) { genTemplate.setContent(StringEscapeUtils.unescapeHtml4(genTemplate.getContent())); }//from w w w. j ava2 s .com if (StringUtils.isBlank(genTemplate.getId())) { genTemplate.preInsert(); genTemplateDao.insert(genTemplate); } else { genTemplate.preUpdate(); genTemplateDao.update(genTemplate); } }
From source file:com.yonyou.dms.function.utils.common.StringUtils.java
/** * unescape html str */ public static String unEscapeHtml(String str) { return StringEscapeUtils.unescapeHtml4(str); }
From source file:com.ryan.ryanreader.views.SubredditHeader.java
public SubredditHeader(final Context context, final RedditSubreddit subreddit) { super(context); final float dpScale = context.getResources().getDisplayMetrics().density; setOrientation(LinearLayout.VERTICAL); final int sidesPadding = (int) (15.0f * dpScale); final int topPadding = (int) (10.0f * dpScale); setPadding(sidesPadding, topPadding, sidesPadding, topPadding); final Typeface tf = Typeface.createFromAsset(context.getAssets(), "fonts/Roboto-Light.ttf"); final TextView title = new TextView(context); title.setTextSize(22.0f);/*from w w w . ja v a 2 s . c o m*/ title.setTypeface(tf); title.setText(StringEscapeUtils.unescapeHtml4(subreddit.title)); title.setTextColor(Color.WHITE); addView(title); final TextView subs = new TextView(context); subs.setTextSize(14.0f); if (subreddit.subscribers == null) { subs.setText("Subscriber count is unknown"); } else { subs.setText(NumberFormat.getNumberInstance(Locale.getDefault()).format(subreddit.subscribers) + " subscribers"); } subs.setTextColor(Color.rgb(200, 200, 200)); addView(subs); setBackgroundColor(Color.rgb(50, 50, 50)); // TODO theme color }
From source file:com.nttec.everychan.chans.chan420.Chan420JsonMapper.java
static List<SimpleBoardModel> mapBoards(JSONObject categories, JSONObject boards) { ArrayList<JSONObject> catsArray = new ArrayList<>(); JSONArray catsJsonArray = categories.getJSONArray("categories"); for (int i = 0; i < catsJsonArray.length(); ++i) catsArray.add(catsJsonArray.getJSONObject(i)); Collections.sort(catsArray, new OrderComparator()); ArrayList<JSONObject> boardsArray = new ArrayList<>(); JSONArray boardsJsonArray = boards.getJSONArray("boards"); for (int i = 0; i < boardsJsonArray.length(); ++i) boardsArray.add(boardsJsonArray.getJSONObject(i)); Collections.sort(boardsArray, new OrderComparator()); List<SimpleBoardModel> list = new ArrayList<SimpleBoardModel>(); for (JSONObject category : catsArray) { int catId = category.optInt("id"); String catName = category.optString("title", ""); boolean catNsfw = category.optInt("nws_category") == 1; for (JSONObject board : boardsArray) { if (board.optBoolean("picked")) continue; if (board.optInt("category") == catId) { board.put("picked", true); list.add(ChanModels.obtainSimpleBoardModel(Chan420Module.CHAN_NAME, board.getString("board"), StringEscapeUtils.unescapeHtml4(board.getString("title")), catName, (catNsfw || (board.optInt("nws_board") == 1)))); }/*from www.jav a 2 s .c o m*/ } } for (JSONObject board : boardsArray) { if (board.optBoolean("picked")) continue; list.add(ChanModels.obtainSimpleBoardModel(Chan420Module.CHAN_NAME, board.getString("board"), StringEscapeUtils.unescapeHtml4(board.getString("title")), "", (board.optInt("nws_board") == 1))); } return list; }
From source file:com.penguineering.cleanuri.sites.reichelt.ReicheltExtractor.java
private static String html2oUTF8(String html) throws UnsupportedEncodingException { final String iso = StringEscapeUtils.unescapeHtml4(html); final byte[] b = iso.getBytes("ISO-8859-15"); return new String(b, "ISO-8859-15"); }
From source file:jobhunter.infoempleo.Client.java
public Job execute() throws IOException, URISyntaxException { l.debug("Connecting to {}", url); update("Connecting", 1L); final Document doc = Jsoup.connect(url).get(); update("Parsing HTML", 2L); final Job job = Job.of(); job.setPortal(InfoEmpleoWebPlugin.portal); job.setLink(url);/*www . j ava2 s .co m*/ job.setExtId(""); final StringBuilder description = new StringBuilder(); doc.getElementsByClass("linea").forEach(td -> { td.getElementsByTag("p").forEach(p -> { description.append(StringEscapeUtils.unescapeHtml4(p.html())).append(System.lineSeparator()); }); }); job.setDescription(description.toString()); job.setPosition(doc.getElementById("ctl00_CPH_Body_Link_Subtitulo").attr("title")); job.getCompany().setName(getCompany(doc)); final String href = doc.getElementById("ctl00_CPH_Body_lnkEnviarAmigoI").attr("href"); final String extId = URLEncodedUtils.parse(new URI(href), "UTF-8").stream() .filter(nvp -> nvp.getName().equalsIgnoreCase("Id_Oferta")).findFirst().get().getValue(); job.setExtId(extId); update("Done", 3L); return job; }