PEAK XOOPS - Re: get_html_translation_table()の罠 in englishin japanese

Top  >  Comments  >  News comment ()

Re: get_html_translation_table()の罠

  • As this forum is only for commentation, you cannot open a new topic
  • Guests cannot post into this forum
Target News
Subject get_html_translation_table()の罠
Summary get_html_translation_table()の罠最近、unhtmlspecialchars() も実装されたようですが、get_html_translation_table() を利用して、htmlspecialchars() の逆関数を作っていた人も多いでしょう。 function my_unhtmlspecialchars( $text , $quotes = ENT_QUOTES ) { r...
Previous post - Next post | Parent - Children.1 .2 .3 .4 .5 | Posted on 2008/6/16 8:58
vaughan  上等兵   Posts: 37
what's the difference between using this method and php native function htmlspecialchars_decode()

or is this just for php 4 backward compatibility?
Votes:8 Average:10.00
Previous post - Next post | Parent - No child | Posted on 2008/7/1 12:40 | Last modified
GIJOE  先任軍曹   Posts: 4110
hi vaughan.

htmlspecialchars_decode() needs PHP5.

We have to write codes working with both PHP4 and PHP5
Votes:10 Average:10.00
Previous post - Next post | Parent - Children.1 | Posted on 2008/7/1 18:27
vaughan  上等兵   Posts: 37
ok thanks :)

on a sidenote: we also discovered when using UTF-8 charsets fully, we ran into a few small issues with icms, which will affect xoops aswell.

in certain conditions, it is not enough to just use htmlspecialchars. but you also need to set which characterset you are using aswell.

as default htmlspecialchars encodes with ISO charset, for utf-8 you need to specify utf-8

example $text = htmlspecialchars($text, ENT_QUOTES, _CHARSET);

especially with function htmlSpecialChars() in xoops textsanitizer
Votes:11 Average:10.00
Previous post - Next post | Parent - No child | Posted on 2008/7/2 12:17
GIJOE  先任軍曹   Posts: 4110
hi vaughan.

Quote:

on a sidenote: we also discovered when using UTF-8 charsets fully, we ran into a few small issues with icms, which will affect xoops aswell.

in certain conditions, it is not enough to just use htmlspecialchars. but you also need to set which characterset you are using aswell.
Which conditions?

As long as I read the source code of PHP in ext/standard/html.c, the third parameter -charset- looks almost non-sense.

And I've never experienced the trouble the charset for htmlspecialchars().
Votes:10 Average:10.00
Previous post - Next post | Parent - Children.1 | Posted on 2008/7/2 17:52
vaughan  上等兵   Posts: 37
we had trouble with some russian languages using utf-8 with the textsanitizer. and we had to add the charset to the end of function htmlSpecialChars() in order to solve it. this could have been caused through various server configs though, because some of us couldn't replicate the issue ourselves.
Votes:10 Average:10.00
Previous post - Next post | Parent - No child | Posted on 2008/7/3 13:37
GIJOE  先任軍曹   Posts: 4110
hi vaughan.

Quote:

we had trouble with some russian languages using utf-8 with the textsanitizer. and we had to add the charset to the end of function htmlSpecialChars() in order to solve it. this could have been caused through various server configs though, because some of us couldn't replicate the issue ourselves.
hmmm...
Certainly, I don't know russian encodings at all.

But, _CHARSET is just 'UTF-8' for russian utf8.
I cannot understand what is wrong about that.
Votes:10 Average:10.00
Previous post - Next post | Parent - Children.1 | Posted on 2008/7/4 2:47
vaughan  上等兵   Posts: 37
me neither. initially we thought it was html purifier causing the problem, but after looking at the function, html purifier was not used at all, so it had to be with that function. the only difference i could see was on php.net they mentioned to set the charset if you use utf-8 encoding. was worth a try anyway and solved the problem in our case.
Votes:10 Average:10.00
Previous post - Next post | Parent - No child | Posted on 2008/7/5 6:57 | Last modified
GIJOE  先任軍曹   Posts: 4110
hi vaughan.

hmmm..
It sounds strange.

We -Japanese- had used UTF-8 with htmlspecialchars() some years ago.
But we've never met troubles about the third parameter.
(Always blank)

Does Russian HTML use some specialcharacters other than <>'"& ??


# If they uses UTF-7, I can understand it though.
Votes:10 Average:10.00
Previous post - Next post | Parent - Children.1 | Posted on 2008/7/5 19:17
vaughan  上等兵   Posts: 37
not sure to be fair. but they may do, i will try to find out.

I thought it strange too as i am aware that you have been using utf-8 for a long while and didn't have these problems.

this however could also be related to us being all PHP 5 now and icms will not work on PHP4.

If I ever discover exactly what was causing it, i'll be sure to let you know :)
Votes:11 Average:10.00
Previous post - Next post | Parent - No child | Posted on 2008/7/6 18:06
GIJOE  先任軍曹   Posts: 4110
hi vaughan.

Thank you for your kindness.
Votes:8 Average:8.75

  Advanced search


Login
Username or e-mail:

Password:

Remember Me

Lost Password?

Register now!