Re: htmlentities and foreign characters from MS Word

From: Date: Sun, 05 Sep 2004 09:38:36 +0000
Subject: Re: htmlentities and foreign characters from MS Word
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-195902@lists.php.net to get a copy of this message
Well it seems you have a UTF-8 encoded text after your function. Use iconv to change it. See http://de3.php.net/manual/en/ref.iconv.php . try doing this with your array before inserting it into the DB foreach($insert_array as $key => $var){ $new_arr[$key] = iconv("UTF-8", "ISO-8859-1", $var); } It can be that your array has a different coding than UTF-8 check the manual for the htmlentities function, but i'm pretty shure that should solve it. I2eptilex Monty wrote:
I'm having a problem figuring out how to deal with foreign characters in text that was copied from an MS Word document and pasted into a form field. I'm not how sure this is getting stored in the MySQL database, but, when I run htmlentities() on this text, each foreign character is converted into 2 other foreign characters that don't at all represent the original. For example, a lowercase u with an umlat over it (ü) is somehow displayed as an uppercase A with an umlat over it followed by the 1/4 symbol after parsed by htmlentities(). A lowercase o with an ulmat displays as an uppercase A with an umlat over it followed by the paragraph symbol. It seems that the uppercase A w/umlat is a constant, and the next character changes. The ord() function returns the same number for all of these foreign characters: 195. So, I'm not sure what's happening with these foreign characters, and if there's any way to convert them to proper htmlentities before being displayed in a browser. I thought htmlentities would do this, actually. Thanks! Monty.


« previous php.general (#195902) next »