html-entities

html entities get passed into database even when I use html_entity_decode

末鹿安然 提交于 2019-12-12 18:15:17
问题 $string = "susan's"; //string is scraped from website $string = html_entity_decode($string); $sql = 'INSERT INTO database SET name = "'. $string .'"'; When I echo out $sql, it shows correct one: INSERT INTO database SET name="susan's" , but when I run query it inserts susan's into database. When I run query manually from phpmyadmin it inserts correct one. Why do html entities get passed to database even when I remove them? 回答1: You need to use the ENT_QUOTES flag constant. As per the manual:

Python convert html ascii encoded text to utf8

断了今生、忘了曾经 提交于 2019-12-12 16:06:15
问题 I have a xml file, which I need to convert to utf8. Unfortunately the entities contain text like this: /mytext, I'm using the codec library to convert files to utf8, but html entities won't work with it. Is there an easy way to get rid of the html encoding? Thanks 回答1: You can pass the text of the file through an unescape function before passing it to the XML parser. Alternatively, if you're only parsing HTML, lxml's http parser does this for you: >>> import lxml.html >>> html = lxml.html

VS Code, copyright symbol © shown as � and saved as � or �

六月ゝ 毕业季﹏ 提交于 2019-12-12 15:06:08
问题 In my html source code I have some special symbols like the copyright one <meta content="© Copyright... /> For some text editors these are shown correctly as above, but on VS Code I see it as � and after I save the file, the symbol will be shown as � and � on other editors. If I explicitly paste the © on VS Code and save it, then on another text editor it will be saved as ©. How can I solve this? What should I do? 回答1: Ensure your file's encoding is set to something which can accurately

HTML Entities with jQuery

我们两清 提交于 2019-12-12 14:35:04
问题 I would like to use replace the value of a submit button with Loading… . The problem is that when I click the button I still see … instead of three dots. Here's my code: $("#myid").val("Loading…"); Should I enter the ellipsis directly from the keyboard in the code above? Is it safe with UTF-8? 回答1: val() or value sets a plain text value. … is HTML, not text; you could use it in innerHTML or .html() , but not in a form field value. If you want to include U+2026 HORIZONTAL ELLIPSIS in a

PHP: Decoding Html Entities

拜拜、爱过 提交于 2019-12-12 10:42:20
问题 I want to decode html entities using php html_entity_decode() but my html entities seem incompatible with the function. Example Input String: html_entity_decode('&lt;strong&gt;'); Outputs: <strong> Removing the 'amp;' solves the problem and produces <strong> but my file has 'amp;' before every html entity. A mass removal of amp; would probably solve the problem, but also very destructive to the html. Is it possible to convert my entities with this situation of an extra amp; before all

Characters not displaying correctly on a UTF-8 website

佐手、 提交于 2019-12-12 09:39:29
问题 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,

PHP htmlspecialchars is not working [closed]

笑着哭i 提交于 2019-12-12 09:37:07
问题 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 8 years ago . <?php $new = htmlspecialchars("<a href='test'>Test</a>", ENT_QUOTES); echo $new; ?> output should be & lt;a href=& #039;test& #039;>Test& lt;/a& gt; but output is <a href='test'>Test</a> 回答1: Don't worry.

Importing HTML table into OO Calc as UTF8 without converting to entities

岁酱吖の 提交于 2019-12-12 08:14:30
问题 I have a problem when opening a HTML table in OpenOffice or LibreOffice if it contains UTF8 extended characters like ÅÄÖåäö. When opening the table into M$ Excel it works as intended but I can't make OO do the same thing. By converting all extended characters to its HTML entity eqivalent Å etc. it works but it would be nice to get the correct characters directly. Is there anyone who knows what I should do? The following content I have in a file called excelsample.xls and if I open that with

Problems in inserting data using “safe way to input data to mysql using PHP”

最后都变了- 提交于 2019-12-12 04:43:44
问题 I am trying to input data using forms into the MySQL, and also using mysql_real_escape_string for this purpose. Unfortunately I am having a problem with the output. It displays \ s, or if I use stripslashes then it removes all slashes. If I submit web's forms using backslash \ I get this output: "web\'s forms using backslash \\" See I got a double backslash. But if I use the stripslashes function then it removes all slashes but also removes inputed slash and the output is "web's forms using

PHP: Split arrays

China☆狼群 提交于 2019-12-12 03:47:08
问题 I am still a beginner and I need some help. I've got an array like this; $_POST= Array ( [0] => aaa@gmail.com [1] => bbb [2] => ccc [3] => ddd [4] => eee [5] => fff [6] => ggg [7] => hhh [8] => iii [9] => jjj [10] => 31 [11] => k ) I want to split the elements up into keys and values, and then get the values and put it into an array. Then I want to put htmlentities around each value like this: foreach (something as something){ echo "htmlentities(".$valuearray.")"; } Can you please help me?