Re: not seeing single quotes and double quotes in php. Appear as ? instead.
- From: "Álvaro G. Vicario" <alvaroNOSPAMTHANKS@xxxxxxxxxxxxxx>
- Date: Tue, 29 Apr 2008 09:13:33 +0200
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 < and > 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
--
.
- References:
- Prev by Date: I couldn't understand why PHP is so popular. The PHP code looks so horrible compared with Java.
- Next by Date: Re: I couldn't understand why PHP is so popular. The PHP code looks so horrible compared with Java.
- Previous by thread: Re: not seeing single quotes and double quotes in php. Appear as ? instead.
- Next by thread: Compression Functions
- Index(es):
Relevant Pages
|