473,383 Members | 1,953 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

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 1808
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: sinister | last post by:
The examples in the online manual all seem to use double quotes, e.g. at http://us3.php.net/preg_replace Why? (The behavior is different with single quotes, and presumably simpler to...
11
by: Jakanapes | last post by:
Hi all, I'm looking for a way to scan a block of text and replace all the double quotes (") with single quotes ('). I'm using PHP to pull text out of a mySQL table and then feed the text into...
3
by: Rock | last post by:
Hi, I started using a python based screen scraper called newsscraper I downloaded from sourceforge. http://sourceforge.net/projects/newsscraper/. I have created many python templates that work...
7
by: Brian van den Broek | last post by:
Hi all, I'm posting partly so my problem and solution might be more easily found by google, and partly out of mere curiosity. I've just spent a frustrating bit of time figuring out why pydoc...
4
by: sankofa | last post by:
hi, i can't seem to be able to escape my single quote properly... is it even possible in javascript? this is a portion of my code.. var DLEWIS="Pastor Lewis"; .... Sermon is a yser-defined...
5
by: Joel | last post by:
Hi, I incorporated a function in my code that whenever I use a string variable in an sql statement if the string contains a single quote it will encase it in double quotes else single quotes. ...
4
by: Greg | last post by:
I keep getting an error when I have a tick mark in a text value that I am searching for in my XPath Query. Example: <Authors> <Author LastName="O'Donnel"> <Author LastName="Smith">...
7
by: gar | last post by:
Hi, I need to replace all the double quotes (") in a textbox with single quotes ('). I used this code text= Replace(text, """", "'" This works fine (for normal double quotes).The problem...
4
by: Justin Fancy | last post by:
Hi everyone, I need to replace all instances of a double quote(") with two single quotes('') in a text file. I already have some replacements of strings going on, but I tried this one, but the...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.