html-entities

Characters not displaying correctly on a UTF-8 website

て烟熏妆下的殇ゞ 提交于 2019-12-10 05:43:35
问题 I've done everything I can think of, but special characters are not displaying correctly on this webpage. For example, in the database it's: But on the site it's: Nouveaux R�alistes Here's everything I've checked... The database is set to UTF-8: The page was written in NetBeans, with the document encoding set to UTF-8: The page header declares UTF-8: The meta charset is set to UTF-8: I've even added the following line to my .htacess: But there characters are still not displaying correctly,

Best practice. Do I save html tags in DB or store the html entity value?

試著忘記壹切 提交于 2019-12-09 13:30:11
问题 I was wondering about which way i should do the following. I am using the tiny MCE wysiwyg editor which formats the users data with the right html tags. Now, i need to save this data entered into the editor into a database table. Should I encode the html tags to their corresponding entities when inserting into the DB, then when i get the data back from the table, not have the encode it for XSS purposes but I'd still have to use eval for the html tags to format the text. OR Do i save the html

How can I remove non-breaking spaces from a JSoup 'Document'?

老子叫甜甜 提交于 2019-12-09 11:59:34
问题 How can I remove these: <td> </td> or <td width="7%"> </td> from my JSoup 'Document'? I've tried many methods, but these non-breaking space characters do not match anything with normal JSoup expressions or Selectors. 回答1: The HTML entity   (Unicode character NO-BREAK SPACE U+00A0) can in Java be represented by the character \u00a0 . Assuming that you want to remove every element which contains that character as own text (and thus not every line as you said in a comment), then the following

htmlentities and é (e acute)

人走茶凉 提交于 2019-12-09 11:37:20
问题 I'm having a problem with PHP's htmlentities and the é character. I know it's some sort of encoding issue I'm just overlooking, so hopefully someone can see what I'm doing wrong. Running a straight htmlentities("é") does not return the correct code as expected (either é or é . I've tried forced the charset to be 'UTF-8' (using the charset parameter of htmlentities) but the same thing. The ultimate goal is to have this character sent in an HTML email encoded in 'ISO-8859-1'. When I try to

How to not transform special characters to html entities with owasp antisamy

陌路散爱 提交于 2019-12-09 07:33:25
问题 I use Owasp Anti samy with Ebay policy file to prevent XSS attacks on my website. I also use Hibernate search to index my objects. When I use this code: String html = "special word: été"; // use the Ebay configuration file Policy policy = Policy.getInstance(xssPolicyFile.getInputStream()); AntiSamy as = new AntiSamy(); CleanResults cr = as.scan(html, policy); // result is now : "special word: été" result = cr.getCleanHTML(); As you can see all chars "é" has been transformed to their html

How to unescape apostrophes and such in Python?

这一生的挚爱 提交于 2019-12-08 16:35:19
问题 I have a string with symbols like this: ' That's an apostrophe apparently. I tried saxutils.unescape() without any luck and tried urllib.unquote() How can I decode this? Thanks! 回答1: Check out this question. What you're looking for is "html entity decoding". Typically, you'll find a function named something like "htmldecode" that will do what you want. Both Django and Cheetah provide such functions as does BeautifulSoup. The other answer will work just great if you don't want to use a library

How to show Unicode characters in IE using HTML

别等时光非礼了梦想. 提交于 2019-12-08 15:48:39
问题 I'm trying to show the copyright and infinity signs at the bottom of my page using this code: &#x00A9 Copyright Mikle 2009 - &#x221E This works perfectly in Firefox 2, 3 and Chrome. IE7 though, is showing me the actual codes (like you see above) instead of what I expect and the other browser show: © Copyright Mikle 2009 - ∞ This is probably some stupid thing, but this is making me understand why IE is getting so much hate. How do I fix this? 回答1: Entities need a semi-colon: © Firefox is being

Prevent jQuery from escaping html entities

倖福魔咒の 提交于 2019-12-08 15:00:42
问题 I have some simple html editor. Let's say that user types following: <p>Ok, this just & sucks :) –</p> and it is saved to some variable: var content = "<p>Ok, this just & sucks :) –</p>"; Now, somewhere I'm using jQuery to append this text to some element: $(this).html(content); // where content is the string above The problem is that it is escaped: <p>Ok, this just &amp; sucks :) &ndash;</p> How can I achieve to have the exact string with &amp ; and &ndash ; and also to have < and not &lt ;

What is the most simple JavaScript HTMLEncode lib/function implementation?

那年仲夏 提交于 2019-12-08 13:30:53
问题 I'm looking for a js function or lib that'll convert special chars like ™ to ™ , does anyone know of any? I'm looking for the simplest one that I can find. 回答1: Those are HTML named entities and they're not a best solution — better use a numerical entities. Why numerical entities are better? Cause you don't have any map like © → © . All you need is a character itself. function abc(input) { var output = ""; var allowedChars = "0123456789qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM";

How to retain textarea contents when PHP page is refreshed?

末鹿安然 提交于 2019-12-08 13:00:00
问题 My dilemma is this: I have a PHP page with a form that includes a textarea where the user can enter any kind of text. The code below is at the top part of my PHP page, to check whether or not the user has pressed the "Submit" button for the form, and to error-check all the user input: <?php // check if user has pressed the Submit button earlier if (isset($_POST['submit'])) { ... $loc = mysqli_real_escape_string($dbc, trim($_POST['location'])); ... The code below is the HTML/PHP code for the