Re: Replacing special characters with their HTML equivalents

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sunday 21 December 2008 5:30:25 pm James Colannino wrote:
> Hey everyone.  I have a question.  I have a web scraper that grabs
> information from web pages that often contain characters such as vowels
> with umlots (I know I spelled that wrong.)
>
> The data is editable, so the characters show up unmodified in an
> editable text box.  However, when I try to import the data into a MySQL
> database, the first occurrence of such a character, along with the rest
> of the string, is truncated from the result.  Not all special characters
> cause the problem; vowels with macrons work, for example.
>
> I don't know if it's failing during the actual query or if the character
> is being filtered out at some earlier stage, but whatever the cause,
> it's not working.
>
> My question is, is there a way to replace these characters with their
> HTML equivalents?  For example, the a with an umlot over the top is
> ä in HTML, so before the query is made, and before the filtering on
> the string is done, I'd like to replace that special character with its
> HTML representation.  This allows the user to see the character while
> it's in its text box, yet at the same time allow it to be successfully
> imported into the database.
>
> I know about str_replace, but assuming it's the right function for the
> job, how would I go about representing these special characters in PHP
> so that it will understand what I'm trying to do?
>
> Thanks!
>
> James

You may find this useful:

http://www.garfieldtech.com/blog/unicode-8-vs-16

-- 
Larry Garfield
larry@xxxxxxxxxxxxxxxx

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux