Title: request charset not work · Issue #2 · phpquery/phpquery · GitHub
Open Graph Title: request charset not work · Issue #2 · phpquery/phpquery
X Title: request charset not work · Issue #2 · phpquery/phpquery
Description: here is test code utf8.php
Open Graph Description: here is test code utf8.php
X Description: here is test code utf8.php <?php require('phpQuery/phpQuery.php'); $html=<<<D <!doctype html> <html lang="en"> <head> <meta name="Keywords&qu...
Opengraph URL: https://github.com/phpquery/phpquery/issues/2
X: @github
Domain: patch-diff.githubusercontent.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"request charset not work ","articleBody":"here is test code \nutf8.php \n\n``` php\n\u003c?php\nrequire('phpQuery/phpQuery.php');\n$html=\u003c\u003c\u003cD\n\u003c!doctype html\u003e\n\u003chtml lang=\"en\"\u003e\n \u003chead\u003e\n \u003cmeta name=\"Keywords\" content=\"\"\u003e\n \u003cmeta name=\"Description\" content=\"\"\u003e\n \u003ctitle\u003e中文ABC\u003c/title\u003e\n \u003c/head\u003e\n \u003cbody\u003e\n\n \u003c/body\u003e\n\u003c/html\u003e\nD;\n$doc = phpQuery::newDocumentHTML($html,'utf8');\necho $doc-\u003efind(\"title\");\n```\n\nresult is \n\n``` D\n \u003ctitle\u003e䏿ABC\u003c/title\u003e \n```\n\naddCharset \n\n``` php\n\n$doc = phpQuery::newDocumentHTML('\u003cmeta charset=\"utf8\"\u003e'.$html,'utf8');\necho $doc-\u003efind(\"title\");\n```\n\nresult is \n\n``` F\n\u003ctitle\u003e䏿ABC\u003c/title\u003e\u003eExit code: 0\n```\n\nthe file is saved as utf8 format \nDOMDocumentWrapper.php\nline 155 \n\n``` php\n $addDocumentCharset = false;\n if ($documentCharset) {\n $charset = $documentCharset;\n $markup = $this-\u003echarsetFixHTML($markup);\n } else if ($requestedCharset) {\n $charset = $requestedCharset;\n }\n\n if (! $charset)\n $charset = phpQuery::$defaultCharset;\n // HTTP 1.1 says that the default charset is ISO-8859-1\n // @see http://www.w3.org/International/O-HTTP-charset\n if (! $documentCharset) {\n $documentCharset = 'ISO-8859-1';\n $addDocumentCharset = true; \n }\n\n```\n\nif $documentCharset no support ,can $requestedCharset overfide $documentCharset ?\ncan \n\n$documentCharset is page embed contenttype meta like \" \u003cmeta charset=\"utf8\"\u003e\"\n $requestedCharset is user parameter like \n\n``` php\n $requestedCharset ='utf8';\n$doc = phpQuery::newDocumentHTML($html, $requestedCharset);\n\n```\n\nwhat's $charset stand for \nthe get charset logic is \n page embed meta charset ? \n ----\u003e user $requestedCharset; ? \n ---\u003e $charset = phpQuery::$defaultCharset;\n\nwhy \n\n``` php\nif (! $documentCharset) {\n $documentCharset = 'ISO-8859-1';\n $addDocumentCharset = true; \n }\n```\n","author":{"url":"https://github.com/tablecell","@type":"Person","name":"tablecell"},"datePublished":"2015-08-29T03:19:30.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/2/phpquery/issues/2"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:14b7020f-d4b2-ea40-e6ad-bceb22af8481 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | ABE2:3F18FE:8B0482:B22D70:69745089 |
| html-safe-nonce | b7c1ff272150fcfe87435e98a36c603c382eb553687968ab148def8fc280455a |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBQkUyOjNGMThGRTo4QjA0ODI6QjIyRDcwOjY5NzQ1MDg5IiwidmlzaXRvcl9pZCI6IjMwODY3NTM3MTEzMzg1NzM5NjEiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | fe41841d0ee5602e76888e8a83a1959b1b3ff8c8226c9adf09fa65333e62132c |
| hovercard-subject-tag | issue:103824819 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/phpquery/phpquery/2/issue_layout |
| twitter:image | https://opengraph.githubassets.com/e9261d8cdf798de0c7c6de512d5050d063d982381d6a425d5b3ccd3c6d65e665/phpquery/phpquery/issues/2 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/e9261d8cdf798de0c7c6de512d5050d063d982381d6a425d5b3ccd3c6d65e665/phpquery/phpquery/issues/2 |
| og:image:alt | here is test code utf8.php |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | tablecell |
| hostname | github.com |
| expected-hostname | github.com |
| None | e0b95d743b7672c9ac0e1032d5f117950182dc164a83434a7db86510e8f0b37c |
| turbo-cache-control | no-preview |
| go-import | github.com/phpquery/phpquery git https://github.com/phpquery/phpquery.git |
| octolytics-dimension-user_id | 6540494 |
| octolytics-dimension-user_login | phpquery |
| octolytics-dimension-repository_id | 16365184 |
| octolytics-dimension-repository_nwo | phpquery/phpquery |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 16365184 |
| octolytics-dimension-repository_network_root_nwo | phpquery/phpquery |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 56fe7e2e8de6e57740bca50402351ea656f7a4bf |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width