Re: convert special characters.

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

 




On Aug 9, 2012, at 6:33 PM, Govinda wrote:

notice there are also these if you end up needing them:

iconv_set_encoding()
iconv()

http://us.php.net/manual/en/function.iconv-set-encoding.php
http://us.php.net/manual/en/function.iconv.php

-Govinda

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



Hmm. So would this be the quick and easy way to set everything to UTF-8?

well... those functions will not "to set everything to UTF-8".
They merely do what they say they will do... e.g. for iconv, "Performs a character set conversion on the string str from in_charset to out_charset." <--- That (iconv's function) does not have anything to do with the charset *of the db* (or table, or what Apache is set to serve, or the file's charset, etc.).

I always feel that the best thing is to learn and understand, so you know, ...exactly where your strings are becoming what/where/why... and figure out how to control all those places of possible transformation.... and where you might not have control, appreciate that is the situation, and figure out how to workaround it.

I am not so expert either. I *assume* that if one did have control of all the places where encoding config-settings can factor in, then one would never need such a thing as iconv(). But PHP is so full of tools.. to give you power just when/where you need it.

My coder spirit always wants to understand exactly what is going on. So if I were you I would want to figure out exactly where your strings are getting transformed into something other than what you expected.. and correct the issue at that spot.

-Govinda


They are getting converted in those functions I posted.
They display correctly when in the text field, but when inserted to the DB by that functions, they get converted.
Then when I echo them out of the DB they are the converted chars.
I think it may be the table or table cell, but I read somewhere on php.net that hemlentities doesn't always convert correctly.
Hence my asking of this question.

Good point to check everything though!
Thanks,

Karl DeSaulniers
Design Drumm
http://designdrumm.com


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



[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux