ID: 43549
Comment by: yossi_shelli at cso dot co dot il
Reported By: mariusads at helpedia dot com
Status: Open
Bug Type: Strings related
Operating System: Redhat?, Linux
PHP Version: 5.2.5
New Comment:
i have the same problem.
I'm using apache server on windows xp to develop my website.
while developing i had php 5.2.2 installed and all worked. today, while
showing the site to a friend of mine, i found out the text outputs, of
the user comments are not showing.
after playing a-bit. i found out the the htmlentities is the problem,
which worked fine before.
also, found out, that removing UTF-8 , will show text, but not in the
encoding which is needed to my website, which is hebrew.
from the first place, htmlentities , did not had a hebrew chars
support, so i used utf-8 which worked fine for me. now, utf-8 setting on
htmlentities resulting in NULL strings, and i don't have a solution to
my problem.
Previous Comments:
[2008-01-03 11:10:20] adam at shiftcreate dot com
I have the same problem - worked before 5.2.5
[2007-12-11 13:33:12] mariusads at helpedia dot com
small update: problem is solved kind of) if I don't specify 'UTF-8' or
if I use htmlspecialchars without 'UTF-8' (though the document looks
different than before, but I guess I'll just have to replace those ascii
characters with images, probably).
[2007-12-11 13:23:52] mariusads at helpedia dot com
The example you gave me does work but my issue has nothing to do with
receiving data in textarea or input boxes.
The page here:
hxxp://www.tgdb.net/pc/faq/5845/Diablo-page1.html
tries to open a text document from a certain location on the drive
which was previously uploaded by the user in a zip file.
If I change the example you gave me to read the text from a file:
html
head
meta http-equiv=content-type content=text/html; charset=utf-8 /
/head
body
pre
?php
$text = file_get_contents('a.txt');
var_dump($text);
var_dump(htmlentities($text,ENT_QUOTES,'UTF-8'));
?
/pre
form name=A method=post
textarea name=text/textarea
input name=sub type=submit value=submit/
/form
/body/html
which basically gets the text from the text file, htmlentities no
longer works as I expected it. I guess with your example, the browser
corrects the text pasted in the form before sending it to the script.
Almost all files I have are like the NFO files in scene releases, they
contain drawings made with ASCII characters, but I need them escaped
because the whole page is sent as UTF-8. They don't have multibyte stuff
on purpose and they're not corrupted or something like that.
It's also not feasible to tell the user to paste them in a text area in
a form, almost all submitted content is sent in a ZIP file and my
scripts extract the text file. Some files are also about 4-600KB in size
(walkthroughs) so using text area is out of the question.
I'm surprised to see that htmlentities returns a blank string and I
honestly don't know how to fix this so any help would be great.
Shouldn't it return the string up until the point where multibyte
characters are, whatever that means?
Could my problem be solved if I don't use the charset argument or if I
use htmlspecialchars? (i'll test...) Or is there another solution to my
predicament?
Thank you again for replying to my questions. I had bad experiences in
the past where other people just ignored my messages after replying with
works for me. I really appreciate it.
[2007-12-11 12:28:40] [EMAIL PROTECTED]
You never specified the charset for the page. This works fine:
html
head
meta http-equiv=content-type content=text/html; charset=utf-8 /
/head
body
pre
?php
$text = isset($_REQUEST['text']) ? $_REQUEST['text'] : '';
var_dump($text);
var_dump(htmlentities($text,ENT_QUOTES,'UTF-8'));
?
/pre
form name=A method=post
textarea name=text/textarea
input name=sub type=submit value=submit/
/form
/body/html
[2007-12-10 11:45:38] mariusads at helpedia dot com
Just downloaded on my computer (Windows 2003, PHP 5.2.5 from website)
and the same problem occurs.
For example this one works:
hxtp://devtgdb.definethis.org:90/pc/faq/5842/Diablo-page1.html
but this one doesn't:
hxtp://devtgdb.definethis.org:90/pc/faq/5845/Diablo-page1.html
The source code is identical, only difference is ads are disabled from
site config.
Also, if the links don't work, sorry, you may read this while I'm
sleeping and my computer is turned off. Otherwise, it's cable
4mbps/512kbps so they should work.
(again, please replace hxtp with http)
The remainder