Giter Site home page Giter Site logo

Comments (20)

GoogleCodeExporter avatar GoogleCodeExporter commented on July 22, 2024

Original comment by [email protected] on 29 Jul 2008 at 11:29

  • Added labels: Milestone-Release1.0

from phpquery.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 22, 2024
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.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 22, 2024
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.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 22, 2024
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.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 22, 2024
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.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 22, 2024
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.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 22, 2024
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.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 22, 2024
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.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 22, 2024
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.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 22, 2024
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.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 22, 2024
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.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 22, 2024
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.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 22, 2024
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.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 22, 2024
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.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 22, 2024
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.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 22, 2024
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.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 22, 2024
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.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 22, 2024
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.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 22, 2024
NB : same effect using "html()" or "append()" method.

Original comment by [email protected] on 16 Oct 2008 at 2:00

from phpquery.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 22, 2024
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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.