撇号 (') 转换为


The Apostrophe (') converts to �

我在数据库中使用数据类型"text"来存储几行内容。但是,当我在我的网站上显示时,任何使用撇号 (') 的单词,例如马来西亚的皈依马来西亚?我该如何解决这个问题?

你需要使用 mysql_escape_string .

例:

<?php
$item = "Zak's Laptop";
$escaped_item = mysql_escape_string($item);
printf("Escaped string: %s'n", $escaped_item);
?>

如果你使用像"你的字符串"这样的单引号,则对字符串使用双qutoes..这可能会有所帮助

你可以使用这个:

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

因为这是一个编码问题。

另外,正如您评论说您正在使用PHP的那样,这也应该有效:

<?php
  echo mb_convert_encoding(file_get_contents('Malaysia's'),
    "HTML-ENTITIES",
    "UTF-8"
  );
?>