Comments (20)
Original comment by [email protected]
on 29 Jul 2008 at 11:29
- Added labels: Milestone-Release1.0
from phpquery.
Hi,
I look on this issue before add the #24.
That's exactly the opposite which happens.
Using "pq('body')->append('żźć');" I haven't any problem.
But using "pq('body')->append('<span>żźć</span>');" I've one!
Original comment by [email protected]
on 15 Aug 2008 at 7:04
from phpquery.
There is a mistake in report content. Inserting text nodes doesn't break
encoding. I
was thinking about inserting new DOMs.
Thx for catching it.
Original comment by [email protected]
on 15 Aug 2008 at 8:59
- Added labels: Priority-High
- Removed labels: Priority-Medium
from phpquery.
Hi,
Perhaps a first response element : replacing the line 1765
"@$DOM->loadHtml($target);" by "@$DOM->loadHtml(utf8_decode($target));" it work
perfectly.
Original comment by [email protected]
on 18 Aug 2008 at 12:19
from phpquery.
Ive applied you idea as tempolary solution, but it doesnt fully solve the
problem
(not all docs are utf8).
Its avaible in /branches/dev, revision 47:
http://code.google.com/p/phpquery/source/detail?r=47
Original comment by [email protected]
on 27 Aug 2008 at 9:49
- Changed state: Started
- Added labels: Priority-Low
- Removed labels: Priority-High
from phpquery.
Yea I just saw it. I'll plan on it in few week I think.
Original comment by [email protected]
on 28 Aug 2008 at 8:12
from phpquery.
Another problem appears.
Always using append when the target element contains no HTML but encoded
characters
like "é" for "é", it display it "brut way", like "testé" display
"testé".
I've try some solution like replacing line 1817 of r47
"$this->DOM->createTextNode(
$target )" by "$this->DOM->createTextNode( $target )" by
"$this->DOM->createTextNode(
utf8_decode(utf8_encode(html_entity_decode($target))) )". It work for this case
but
don't work using "append('testé')" directly :/.
I'm searching...
Original comment by [email protected]
on 8 Sep 2008 at 9:36
from phpquery.
NB : actually I'm using "append('<span>'.$myText.'</span>')" to do it.
Original comment by [email protected]
on 8 Sep 2008 at 9:43
from phpquery.
Try this:
$htmlCode = mb_convert_encoding($htmlCode, 'HTML-ENTITIES', "UTF-8");
Original comment by [email protected]
on 8 Sep 2008 at 10:00
from phpquery.
Thanks for the tip.
To make it work we must reverse the parameters like that :
"mb_convert_encoding($htmlCode, "UTF-8", 'HTML-ENTITIES');".
But I've always the same problem : the solution which work with "testé" don't
work with "testé" and reverse.
We should detect which one is, and then, call the function.
But how to detect it?
Original comment by [email protected]
on 9 Sep 2008 at 7:53
from phpquery.
NB : I've had this "mb_internal_encoding('UTF-8');", it's OK but the problem
stays.
Also, i've tryed lot of solutions, not only "mb_convert_encoding($htmlCode,
"UTF-8",
'HTML-ENTITIES');", but nothing right for the both case :/.
Original comment by [email protected]
on 9 Sep 2008 at 7:55
from phpquery.
Solution find!
I've replaced the else statement at line 1814 in r47 by
"
// insert selected element
} else {
if (mb_detect_encoding($target)=='ASCII')
$target =
mb_convert_encoding($target,'UTF-8','HTML-ENTITIES');
$insertFrom = array(
$this->DOM->createTextNode(
$target )
);
}
"
Enjoy ^^! But need to be really FIX like the utf8_decode() adding.
Original comment by [email protected]
on 9 Sep 2008 at 8:23
from phpquery.
One solve, one appears :/.
Using "appendTo($phpQueryObject)" all my textnode is truncated after the first
accentuated characters (i.e. : "Article propriété" become "Article propri?").
That's happening appening a list element containing some items :
<code>$myFirstPhpQueryElement->appendTo($mySecondPhpQueryElement);</code>
Plan on it actually...
Original comment by [email protected]
on 9 Sep 2008 at 1:14
from phpquery.
I happily cannot reproduce "truncated after the first accentuated characters" ;)
Ive applied all patches mentioned here in r49 and added a test case in
test_encoding.php which tries to reproduce your last report.
Original comment by [email protected]
on 13 Sep 2008 at 7:17
- Added labels: Priority-Medium
- Removed labels: Priority-Low
from phpquery.
I have also change the attr() method replacing <code>$node->setAttribute($a,
$value);</code> with <code>
$node->setAttribute($a, mb_convert_encoding($value, 'UTF-8',
'HTML-ENTITIES'));</code>
<code>mb_convert_encoding($value, 'UTF-8', 'HTML-ENTITIES')</code> seems to be
very
usefull in this quest :). I think.
Original comment by [email protected]
on 17 Sep 2008 at 12:07
from phpquery.
Ive added attr fix in r52 or r53.
This seems to fix all issues for utf8 documents ?
Original comment by [email protected]
on 17 Sep 2008 at 2:58
from phpquery.
Issue 60 should fix this one. Not only for utf-8.
http://code.google.com/p/phpquery/issues/detail?id=60
Please check.
Original comment by [email protected]
on 16 Oct 2008 at 12:16
from phpquery.
Having a charset trouble using r203.
And it was OK before r203.
Doing :
<php>
$miniature_element
->find('th.mois_enCours')
->text(strtolower(strftime('%B %Y',$ts_actuel)))
;
</php>
"strftime('%B %Y',$ts_actuel)" return "décembre 2008".
Before R203, no problem.
With R203 it don't display the "é" correctly (under ff display a "?" in a
diamond).
Original comment by [email protected]
on 16 Oct 2008 at 1:56
from phpquery.
NB : same effect using "html()" or "append()" method.
Original comment by [email protected]
on 16 Oct 2008 at 2:00
from phpquery.
strftime by default returns string in latin1 charset. Read more about it in
this comment:
http://pl.php.net/manual/en/function.strftime.php#72482
Tested and worksforme:
setlocale(LC_ALL, 'pl_PL.UTF-8');
$string = strftime('%B %Y', time());
$doc['p:first']->append($string)->dump();
Marking this issue as fixed, as all inserts/appends to an existing document
honors
target document's charset. No charset conversions are implemented.
Original comment by [email protected]
on 18 Oct 2008 at 8:48
- Changed state: Fixed
from phpquery.
Related Issues (20)
- Unable to install using pear HOT 7
- pear repo packages.xml seems broken
- Wrong parsed HTML from HTML cleared by Tidy
- default: added to all HTML tags via Clone & PrependTo
- typo in line 517
- when program is utf-8,but remote page is gbk , the wrong has occur
- A PHP Error was encountered
- How to print the whole array of result without using foreach
- Notice (8): Undefined variable: hltml [phpQuery\DOMDocumentWrapper.php, line 389]
- GPL ?
- DOMDocument::importNode(): Cannot import: Node Type Not Supported
- Nested elements in script tag / create elements with jQuery
- Case-sensitive tag selectors HOT 3
- phpquery-onefile.php line 517
- Using multiple selectors return element list in wrong order
- Patch for /branches/dev/demo.php
- elements with dots "." in their id cannot be selected
- Getting Started Page
- How to use http-proxy for getBrowser & ajax requests? HOT 1
- your api docs have been hacked
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from phpquery.