How can I find out what character set is in a textbox in a MySql database if I only know that text
The problem starts when they change php ver from 5.3 to (5.4., 5.5, 5.6)
I have text in the table as follows:
$rus3="Ð’Ñ‹ не хватает путевок. Ð"оплачиваетÑÑ. Ðажмите OK и выберите нужный пакет ...";
I need to convert a lot of text to a readable table in utf8
Then I use:
$rust3=iconv("UTF-8","windows-1252//IGNORE",$rus3);
And it's in Russian Cyril, like this:
rust3: You don't have enough travel packages. Pays extra. Click OK and select the required package ...
But not all characters are converted, and some characters are poorly converted with these parameters to the iconv function. I also have over 4 languages with special characters decomposing the language in the database fields that I have to convert to be visible and legible.
How can I know which character set the text is in if there is only that text (s) and how best to convert it to utf8. When I get from sql command on mysql database set it already in utf8.
source to share
you may try
$str = "bla bla bla";
echo mb_detect_encoding($str);
will give you a char set
How to check mysql db charset you can use
mysql_client_encoding($conn);
so according to your question you can try
echo mb_convert_encoding($rus3, "UTF8", "auto");
instead of iconv. If it helps to know more about mb_convert_encoding
source to share