468,746 Members | 1,784 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,746 developers. It's quick & easy.

not seeing single quotes and double quotes in php. Appear as ? instead.

raj
Hi all,

I'm using this code to import some a .txt files onto a webpage, but I
keep seeing single quotes amd double quotes as question marks.

Here's the code:

<textarea disabled="disabled" name="textarea2" cols="70" rows="7"
wrap="virtual"><?php addslashes(include("../license/license.txt")); ?>
</textarea>

Can someone tell me where I'm going wrong?

Thank you in advance,

Raj (newbie)

Jun 2 '08 #1
2 1632
raj wrote:
Hi all,

I'm using this code to import some a .txt files onto a webpage, but I
keep seeing single quotes amd double quotes as question marks.

Here's the code:

<textarea disabled="disabled" name="textarea2" cols="70" rows="7"
wrap="virtual"><?php addslashes(include("../license/license.txt")); ?>
</textarea>

Can someone tell me where I'm going wrong?

Thank you in advance,

Raj (newbie)

addslashes() is the wrong function in this case. Look at
htmlspecialchars() or htmlentities()

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================

Jun 2 '08 #2
raj escribió:
I'm using this code to import some a .txt files onto a webpage, but I
keep seeing single quotes amd double quotes as question marks.

Here's the code:

<textarea disabled="disabled" name="textarea2" cols="70" rows="7"
wrap="virtual"><?php addslashes(include("../license/license.txt")); ?>
</textarea>
I'd say you've written license.txt with some word processor like
Microsoft Word and it uses quotes like “foo” and ‘bar’ (rather than
"foo" and 'bar'). You must convert the file into whatever charset your
site uses (typically ISO-8859-1 or UTF-8, but I can't assure). If you
don't have a good text editor that can do it for you, you can use
iconv() in PHP. Or simple change the quotes manually.

Also, you must replace < and with &lt; and &gt; entities. You can use
htmlspecialchars() for the task but you can't apply functions to the
output of include! You need to fetch the file with a function that
returns a string, such as file_get_contents().
--
-- http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
-- Mi sitio sobre programación web: http://bits.demogracia.com
-- Mi web de humor al baño María: http://www.demogracia.com
--
Jun 2 '08 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by sinister | last post: by
11 posts views Thread by Jakanapes | last post: by
3 posts views Thread by Rock | last post: by
4 posts views Thread by sankofa | last post: by
5 posts views Thread by Joel | last post: by
reply views Thread by zhoujie | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.