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

This is a discussion on not seeing single quotes and double quotes in php. Appear as ? instead. within the PHP Language forums, part of the PHP Programming Forums category; Hi all, I'm using this code to import some a .txt files onto a webpage, but I keep seeing ...


Go Back   Usenet Forums > PHP Programming Forums > PHP Language

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-28-2008
raj
 
Posts: n/a
Default not seeing single quotes and double quotes in php. Appear as ? instead.

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)

Reply With Quote
  #2 (permalink)  
Old 04-28-2008
Jerry Stuckle
 
Posts: n/a
Default Re: not seeing single quotes and double quotes in php. Appear as? instead.

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.
jstucklex@attglobal.net
==================

Reply With Quote
  #3 (permalink)  
Old 04-29-2008
Álvaro G. Vicario
 
Posts: n/a
Default Re: not seeing single quotes and double quotes in php. Appear as? instead.

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
--
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 07:50 PM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0