weixin_39527879 2020-11-30 11:28
浏览 0

[OSQA-664] Missing letters in slug when transliterating Polish characters in question titles

[reporter="karoldvl", created="Tue, 3 May 2011 12:55:51 -0400"] When using some Polish characters in a question title, the generated slug (URL) discards some of the characters instead of providing best ASCII alternatives.

Example:

Given I create a new question
When I use "Zażółć gęślą jaźń" as a title
Then the generated slug should be: "zazolc-gesla-jazn"

Instead I get "zazoc-gesla-jazn"
(missing 'ł' -> 'l' conversion)

You can leave it as is for the time being, I will attach a proposed patch later when I come to fix it. Reported so that I don't forget to fix it and share the patch in the end.

该提问来源于开源项目:dzone/osqa

  • 写回答

6条回答 默认 最新

  • weixin_39527879 2020-11-30 11:28
    关注

    [author="karoldvl", created="Thu, 5 May 2011 17:24:37 -0400"] I've managed to overcome this problem by wrapping all input to Django's slugify calls and filters in unidecode() from the unidecode package (http://pypi.python.org/pypi/Unidecode/0.04.1). I've also added missing smart_unicode calls. Probably not all were indispensable, but better safe than sorry. This resolves not only question slugs, but slugs all around the site.

    As I didn't expect a direct pull, I didn't separate that into a topic branch, so there are some changes to my custom skin to omit.

    Visual commit: https://github.com/karoldvl/meltdown-osqa/commit/368646bdc633eba7868886bd61d3048ec96af80c
    Proposed patch: https://github.com/karoldvl/meltdown-osqa/commit/368646bdc633eba7868886bd61d3048ec96af80c.diff


    评论

报告相同问题?