Reputation: 73
I have plain Japanese hieroglyphs texts with utf8mb_general_ci in MySQL table, I can fetch row and display as a single string. But what I need is to get a single character from string and use it for a query to match other results(find other hieroglyphs words that consist of that specific single hieroglyph). Problem is that when I loop that string, all I get is ? marks. I read that I have to use UTF8 everywhere but I believe I do.
So, what are the steps from zero to make sure so I can fetch Japanese hieroglyph string, split into separate chars and queries would understand what kind of input is that(not just a ? mark).
Here's some basic code below as an example with the same data that I fetch from my DB and which results in the same problem.
<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
</head>
<body>
<?php
$word = "東京のビルの中";
echo $word;
echo strlen($word);
echo "<br>";
$chars = str_split($word);
foreach($chars as $single) {
echo $single . "<br>";
}
?>
</body>
</html>
Upvotes: 1
Views: 1351