html-entities

html entities/escape for dynamic url (ajax updated url)?

独自空忆成欢 提交于 2019-12-12 02:29:13
问题 var fb_ps_page = window.location.href; document.write('<iframe src="//www.facebook.com/plugins/like.php?href=' + fb_ps_page + '&send=false&layout=button_count&width=450&show_faces=false&action=like&colorscheme=light&font&height=21&appId=205223179497882" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:21px;" allowTransparency="true"></iframe>'); My function to write the dynamic url to facebook like button. But, my url contains / , # , + , and & - do I

php no good escape

一世执手 提交于 2019-12-12 02:14:44
问题 I have a script like this: document.getElementById('debugLayer').innerHTML = '<?php foreach (self::$errorLogs as $item) { echo htmlentities ($item, ENT_QUOTES).'<hr />'; } ?>'; where $errorLogs is an array of list. But it must have not escape correctly, since firefox say to this: Error: malformed Unicode character escape sequence Source File: X Line: 553, Column: 63 Source Code: document.getElementById('debugLayerDIVcontent_10').innerHTML = '<span style="background-color:yellow;"><i>Missing

While using HTML entities, it also translates ampersand &

蓝咒 提交于 2019-12-11 18:46:48
问题 I am working on a ASP.NET MVC multi language web site. When I put for example é to achieve this é , it changes it to &#233; . It seems that it first translates & to & . What is the problem? 回答1: Ok I think I might see what you are referring to. In the meta tags in the head of your document é is changing to &#233; but the entities in the body are correct. You have perhaps copied and pasted é from a rich text environment (i.e. an rtf or perhaps a .doc file) and it may contain an encoded

show text value of html © entity in input type=text?

ぃ、小莉子 提交于 2019-12-11 16:45:14
问题 I'm loading a value from a json file which contains a copyright character. It's stored in the json as a html entity - © which renders ©. Handlebars is rendering a file editor for me in such a way that if the string is long it gets made into a textarea, and if it's short then it becomes a text input box instead. When rendered to a <textarea> the value is shown as its string version - something like © 2013 blah foo inc , whereas if the value is written to a <input type='text'> value, then the

htmlentities converts trademark into � [duplicate]

孤街醉人 提交于 2019-12-11 15:38:43
问题 This question already has an answer here : Closed 7 years ago . Possible Duplicate: PHP htmlentities() not working as expected I am using htmlentities to convert a trademark symbol into the htmlentity, but it is giving me â�¢ . Am I doing something wrong here is my code <?php echo '<?xml version="1.0" encoding="utf-8"?>'; ?> <rss version="2.0" xmlns:g="http://base.google.com/ns/1.0" xmlns:c="http://www.base.google.com/cns/1.0"> <channel> <title>Spray Foam Systems</title> <link>http://www

Character Entity References - numeric or not?

蹲街弑〆低调 提交于 2019-12-11 15:29:17
问题 So, i know that I can represent an apersand as & or & . I have found that at least one method of parsing XML does not allow for the abbreviation-based style - only numeric. Is there a best-practice? I want to instruct my team to use the numeric versions because of my experience, but one instance hardly seems like enough reason to convince them. Can anyone provide any other insight as to which method to favor? 回答1: XML only has a small set of these symbolic entities, for amp, quot, gt and lt.

MySQL database contains quotes encoded and unencoded and it's breaking javascript

倖福魔咒の 提交于 2019-12-11 15:20:41
问题 Example database value is '12345' which is assigned to a PHP variable $name . This value is used in a javacript onclick event for example: onclick="assign('<?php echo $name;?>') What is the best way to deal with this? onclick="assign('<?php echo $name;?>') // output: onclick="assign(''12345'') onclick="assign('<?php echo htmlspecialchars($name);?>') // output: onclick="assign(''12345'') onclick="assign('<?php echo addslashes($name);?>') // output: onclick="assign(''12345\'') onclick="assign('

Saving and Displaying HTML and special characters in a mysql database safely?

允我心安 提交于 2019-12-11 13:06:45
问题 The title basically sums it up. I built a small blog but I cant even post links in my articles! What can I do? I've tried htmlentities() , htmlspecialchars() , real_escape_string() and basically every form of escape there is. I am using PHP 5.3 with MySQL 5.1 Here is my code to save the blog to the db: function check_input($data, $problem='') { $data = trim($data); $data = stripslashes($data); $data = htmlentities($data); if ($problem && strlen($data) == 0) { die($problem); } return $data; }

PHP function to convert from html codes to normal chars

 ̄綄美尐妖づ 提交于 2019-12-11 11:48:38
问题 I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function should I use to convert the ’ to the actual "normal" char ' : La Torre Eiffel paragonata all’Everest I'm using CURL to fetch a page and this page has that string in it but for some reason the HTML chars are not decoded. The my_url test page is an Italian blog with iso characters, and all the apostrophes are encoded in html code like above. $output = curl_download($my_url); $output = htmlspecialchars_decode(

Star ★ Not showing in Chrome

偶尔善良 提交于 2019-12-11 10:26:43
问题 I have some html where the star is simply in the code like so: <strong>This is my ★ star, I'm not using entities!</strong> It works in Firefox, but not in Chrome (which displays a box). Why? 回答1: Just to expand on Gil's answer, the unicode character entity for star ★ was not showing for me in Chrome, but it was in Firefox. I found that just as Gil says, it did work in Chrome when it was in the html at page load, but it did not work in Chrome when the html containing the star was loaded