这是一个困难的问题:
我正在开发一个大部分内容都是日语的网站。
但考虑这个网址:
http://www.stackoverflow.com/质问/日本语のURLはどうする
大多数 URL 解析器,包括 stackoverflow 的,都不知道在哪里分隔包含日语的 URL。不好。
我还没有检查过其他浏览器,但 Google Chrome 会用日语显示 URL 解码的日语 URL,当您复制 URL 时,它会对其进行 URL 编码:
http://www.stackoverflow.com/%E8%B3%AA%E5%95%8F/%E6%97%A5 %E6%9C%AC%E8%AA%9E%E3%81%AEURL%E3%81%AF%E3%81%A9%E3%81%86%E3%81%99%E3%82%8B
这是正确的做法,但并不是最友好的。所以,我想,我应该让内容提供者输入简短的英文,如下所示:
http://www.stackoverflow.com/questions/what-to-do-with-japanese-urls
太棒了。但这有两个问题:
- 大多数提供内容的人都会说一点英语——但他们说的英语比英语多。所以他们可能会写一些类似“what-do-to-with-japenese-ulrs”的内容。
- Google Japan 可能不像对日语 URL 那样对英语 URL 感兴趣。
关于最佳行动方案有什么想法吗? :D
Here's a tough one:
I'm working on a website where most of the content is in Japanese.
But consider this url:
http://www.stackoverflow.com/質問/日本語のURLはどうする
Most URL parsers, including stackoverflow's, don't know where to delimit URLs that contain Japanese. Not good.
I haven't checked with other browsers yet, but Google Chrome will display URL-decoded Japanese urls in Japanese -- and when you copy the url, it URL-encodes it:
http://www.stackoverflow.com/%E8%B3%AA%E5%95%8F/%E6%97%A5%E6%9C%AC%E8%AA%9E%E3%81%AEURL%E3%81%AF%E3%81%A9%E3%81%86%E3%81%99%E3%82%8B
That's the right thing to do, but it's not exactly the most friendly. So, I thought, I'd have the content providers just type in short English slugs, like this:
http://www.stackoverflow.com/questions/what-to-do-with-japanese-urls
Awesome. But there's two problems with this:
- Most of the people providing the content speak a modicum of English --- but they speak more Engrish than English. So they're likely to write something like "what-do-to-with-japenese-ulrs".
- Google Japan might not be as interested in the English URL as it might be in the Japanese one.
Any thoughts on the best course of action? :D
发布评论
评论(3)
日本各大网站在这个问题上似乎存在一些分歧。例如,日语维基百科和 amazon.co.jp 使用编码的日语。但英国蛞蝓似乎是最常见的。请查看 http://fujifilm.jp/ 示例。
我认为你对搜索引擎的担忧是非常合理的,而且在你的立场上,这可能足以让我倾向于使用编码的日语。但这会有点痛苦——那里有很多出错的机会。
另外,正如 Mike 指出的那样,stackoverflow 所做的几乎是正确的事情,因为 url 需要进行编码。
The big Japanese websites seem to be somewhat divided on this question. Japanese wikipedia and amazon.co.jp use encoded Japanese, for instance. But the English slugs seem to be the most common. Take a look at http://fujifilm.jp/ for an example.
I think your concern about search engines is pretty valid though, and in your position that might be enough to tip the balance in favor of using encoded Japanese for me. It would be a bit of a pain though- lots of opportunity for error there.
Also, as Mike points out, what stackoverflow is doing is pretty much the right thing, as the url needs to be encoded.
不幸的是 HTTP 没有本机 unicode 支持。所有 unicode URL 路径和查询参数都需要进行编码。如果需要,您可以使用 unicode 编码而不是 % 编码,但这仍然不会使 URL 更具可读性。
Unfortunately HTTP doesn't have native unicode support. All unicode URL path and query params need to be encoded. You can use unicode encoding instead of % encoding if you want, but that will still not make the URL any more human readable.
使用罗马字音译?
http://www.stackoverflow.com/questionu/nihonnoURLwadousuru
:DUsing romaji transliteration?
http://www.stackoverflow.com/questionu/nihonnoURLwadousuru
:D