Pavlos1316
Pavlos1316

Reputation: 444

encode or decode string from mysql using php

In my db I have a field value looking like this:

ΜΑΚΑΡΙΟΥ Γ\'

I think it must be Greek chars inserted when I didn't have set UTF-8 for my db (I think I was using the default Latin 1).

Is there a way to get the actual characters?

Thank you

Upvotes: 1

Views: 1406

Answers (2)

DWright
DWright

Reputation: 9500

Try saving the data into a text file and opening the text file in a hex editor (there are a bunch of good free ones). That could show you the underlying code values of the letters, which you could then match against published encodings.

For example, this page lists Unicode values for Polytonic Greek values (not sure you were using Polytonic, though): http://leb.net/reader/text/standards/unicode/old/MappingTables/NewTables/Polytonic_Greek.txt.

Looking at the text with a hex editor will help you to get code values to look up in lookup tables like this.

Upvotes: 0

Dino Babu
Dino Babu

Reputation: 5809

Not sure, Try this :

$str = "ΜΑΚΑΡΙΟΥ Γ\'";
$val = iconv(mb_detect_encoding($str), "UTF-8", $str);
echo $val;

Upvotes: 2

Related Questions