在 MYSQL 中搜索具有西班牙口音的圣经网站字符集

Bible website charset with spanish accents search in MYSQL

我将 运行 一个圣经网站,所以我使用 MYSQL 默认字符集 latin1_swedish_ci 创建了数据库,但该网站将使用西班牙语。

问题是创世记使用重音,Éxodo 和 Josué 也是如此,所以当人们搜索例如:

$getbook = $_GET['L'];
$bible = mysqli_query($database, "SELECT * FROM `bible` WHERE `book` LIKE '%$getbook%'");

如果人们搜索不带口音的 Genesis,则会有结果,但如果人们搜索带口音的 Génesis,则不会有任何结果。

这是我显示结果的脚本:

<?php
$server = 'localhost';$user = 'username';$pass = 'password';$source = 'this';
$database = @mysqli_connect ($server, $user, $pass, $source) OR die ('Could not connect to MySQL: ' . mysqli_connect_error());
header ('Content-type: text/html; charset=iso-8859-15');
$getbook = $_GET['L'];
$bible = mysqli_query($database, "SELECT * FROM `bible` WHERE `book` LIKE '%$getbook%'");
while($show = mysqli_fetch_assoc($bible)) {
?>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-15">

<table width="80%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td width="10%">Chapter</td>
    <td width="10%">Verse</td>
    <td width="80%">Text</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
</table>
<table width="80%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td width="10%"><?php echo $show['chapter'] ?></td>
    <td width="10%"><?php echo $show['verse'] ?></td>
    <td width="80%"><?php echo $show['text'] ?></td>
  </tr>
</table>
<?php
}
?>  

结果文本还可以,唯一的问题是当您使用重音符号进行搜索时。它显示 Genesis 的结果,但不显示带重音的 Génesis 的结果。

这里是要测试的真实站点:

WITH ACCENT:
http://santabiblia.cl/?L=Génesis 
no results

WITHOUT ACCENT:
http://santabiblia.cl/?L=Genesis 
Yes we have results

有什么想法吗?

编辑

数据库看起来像

DB_NAME 圣经 -> 书 - 章 - 节 - 正文

例子

book = Génesis(带口音)chapter = 1 verse = 1 = text = 起初上帝创造了天地(但用的是西班牙语)En el principio, Dios creó los cielos y la tierra。

MYSQL结构在latin1_swedish_ci,用latin1_spanish_ci测试,同样的问题,用UTF8测试,更糟

您需要修改提交脚本 L 并 URL 对其进行编码,而接收脚本 URL 对其进行解码。