【问题标题】:URL encoding spanish wordsURL 编码西班牙语单词
【发布时间】:2013-02-28 07:41:32
【问题描述】:

我正在制作一本西班牙语词典。我从 www.rae.es 得到定义。问题:

搜索引擎不适用于重音 (á é í ó ú )。输出是来自 rae.es 的错误消息,指出无法识别该单词。例如:对于单词“baúl”,出现(翻译):“单词 baúl 没有在字典中注册。”

如何使用 urlencode() 或其他函数来解决这个问题?请通过右键单击检查代码并使用 Google Chrome、Safari 或 Firefox 检查元素。

http://verbum.xtrweb.com/verbumpost.php?word=ba%C3%BAl&word0=

谢谢!

【问题讨论】:

标签: php javascript html urlencode encode


【解决方案1】:

尝试使用urlencode(utf8_encode($string)) 而不仅仅是urlencode($string)。

【讨论】:

  • 让我们看看。浏览器发送 UTF-8 编码的 GET 请求。 PHP 将它们解码为 latin1。 urlencode() 将如何提供帮助?
  • 如果我的变量是 $words ,我应该把它写成
【解决方案2】:

在您的搜索词中使用 htmlentities 并尝试使用 post,而不是获取: http://php.net/manual/en/function.htmlentities.php

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2017-12-29
    • 1970-01-01
    • 1970-01-01
    • 2013-01-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多