Open ahmozkya opened 14 years ago
As this feature will include expansive RegExp work, I believe this must be implemented as "pluggable" option, e.g.:
set :utf8, true
So this will enable extra-worker for those who write non-ascii blogs :))
The second thing I guess we need to agree is how we are going to work with such titles. The easiest way is to implement one-way conversion, e.g. files would be in ascii format, like: 2011-08-13-proverka.txt
, while titles will allow non-ascii chars without any problems, e.g. проверка
. This way is easy, but looks more like a workround, so the best behavior (I believe) is to allow two-way conversion, so URL /2011/08/13/proverka
will try to get file 2011-08-13-проверка.txt
and then 2011-08-13-proverka.txt
I also have this problem. It returns 404 because it cannot find articles with non ASCII characters in the title since the slugize method removes them, and def path
at line 274 returns the slug. We have to deslug the path in def go
.
Something like bellow should work.
def article route
path = self.articles.select do |article|
File.basename(article, ".#{self[:ext]}").slugize.eql? route.join('-')
end.last || File.join(Paths[:articles], "#{route.join('-')}.#{self[:ext]}")
Article.new(path, @config).load
end
Unfortunately, there is an encoding issue. File.basename(article, ".#{self[:ext]}").slugize
fails to equal route.join('-')
in certain cases. Even though the string can look identical to the eye, slugize
can generates different slugs.
This code does not make the correct utf-8 conversion.
The following link will probably help. http://code.djangoproject.com/browser/django/tags/releases/1.1.1/django/contrib/admin/media/js/urlify.js