TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 06-03-2008, 07:58 PM   #1 (permalink)
The Contributor
 
oMIKEo's Avatar
 
Join Date: Jan 2008
Location: Leeds
Posts: 52
Thanks: 7
oMIKEo is on a distinguished road
Default Importing text

Hi,

Im importing alot of text that contains bits such as:

“ and ” and ’

These are not understand in IE/FF and come up as either squares or diamond question marks.

Any ideas how i can dynamically remove them just before echoing out the text?

Regards,
Michael
Send a message via MSN to oMIKEo
oMIKEo is offline  
Reply With Quote
Old 06-03-2008, 09:56 PM   #2 (permalink)
The Frequenter
Newcomer 
 
xenon's Avatar
 
Join Date: Dec 2007
Location: Bucharest, Romania
Posts: 438
Thanks: 3
xenon is on a distinguished road
Default

You could call htmlentities on that piece of text and see if that works. Otherwise, use a multibyte encoding.
__________________
I have optimistic thoughts, even though sometimes (if not always) life's a bitch.
xenon is offline  
Reply With Quote
Old 06-04-2008, 07:28 AM   #3 (permalink)
Jim
The Addict
 
Jim's Avatar
 
Join Date: Nov 2007
Location: the Netherlands
Posts: 281
Thanks: 2
Jim is on a distinguished road
Default

htmlentities work i thought but (in my case) it gives errors in W3C. I recommend replacing them with " and ' which is what i simply do :>
__________________
Nunchaku! Who doesn't like martial arts? =)
Send a message via MSN to Jim Send a message via Skype™ to Jim
Jim is offline  
Reply With Quote
Old 06-04-2008, 08:17 AM   #4 (permalink)
The Wanderer
 
Join Date: May 2008
Posts: 10
Thanks: 0
Folio is on a distinguished road
Default

I often encounter this problem when clients post a chunk of text from Word.
If you do a find and replace in word, often it will re-replace them with what was originally there.
What i've started doing is a find and replace within notepad... simple - but it works better.
Also, htmlentities shouldn't hinder your validation... it simply alters text. Maybe you have HTML tags in the text?
nl2br also helps when replacing "new lines" with "break tags"

hope that helps
Folio is offline  
Reply With Quote
Old 06-09-2008, 08:37 PM   #5 (permalink)
The Contributor
 
oMIKEo's Avatar
 
Join Date: Jan 2008
Location: Leeds
Posts: 52
Thanks: 7
oMIKEo is on a distinguished road
Default

I have tried the following but it doesnt seem to do anything at all:

PHP Code:
$biog str_replace("’""'"$biog);
$biog str_replace("‘""'"$biog);
$biog str_replace("“""\""$biog);
$biog str_replace("”""\""$biog); 
I couldnt work out what options to use with htmlentities as it always seemed to do nothing.

There is too much information to go through manually and correct them by hand.

Thanks for any more advice.
Send a message via MSN to oMIKEo
oMIKEo is offline  
Reply With Quote
Old 06-09-2008, 09:34 PM   #6 (permalink)
Wizard
Top Contributor 
 
Village Idiot's Avatar
 
Join Date: Sep 2007
Posts: 1,299
Thanks: 17
Village Idiot is on a distinguished road
Default

You could probably fix this error by setting your HTML encoding type to ISO-8859-1 (western). You are most likely on UTF-8, because when I change the page encoding to that, those question marks pop up.
__________________

Village Idiot is offline  
Reply With Quote
Old 06-09-2008, 10:09 PM   #7 (permalink)
The Contributor
 
oMIKEo's Avatar
 
Join Date: Jan 2008
Location: Leeds
Posts: 52
Thanks: 7
oMIKEo is on a distinguished road
Default

i changed to this:

<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1">

But they still come up as squares?
Send a message via MSN to oMIKEo
oMIKEo is offline  
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
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 On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT. The time now is 02:26 PM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design