MovableType Dirify Change for UTF-8

This is for MovableType 3.2, but the same for 3.3, or 4.0, 4.01.

In the file /mt/lib/MT/Util.pm, there are two lines. I have to change it from:

LINE 553: sub dirify {

LINE 554: ($MT::VERSION && MT->instance->{cfg}->PublishCharset =~ m/utf-?8/i)

LINE 555: ? utf8_dirify(@_) : iso_dirify(@_);

LINE 556: }

It has to be changed to

LINE 553: sub dirify {

LINE 554: # ($MT::VERSION && MT->instance->{cfg}->PublishCharset =~ m/utf-?8/i)

LINE 555: iso_dirify(@_); # ? utf8_dirify(@_) : iso_dirify(@_);

LINE 556: }

I made all the changes to my installation base of MoableType.

The reason is, I have all the titles dirified to become the URL. In Chinese names, the newer version (which actually fixed a bug) simply turns all UTF-8 (Chinese title) into nothing, which is not friendly for users.

After the change, the entry titled “Wendy说过一句话” will be in URL: http://home.wangjianshuo.com/cn/20071121_wendyeeaee.htm

Although the Chinese part was lost, at least it is some way of distinguishing different entries, and this encoding does not change along with the database. It does not has any type of IDs in it. Imagine if you have entry_id in the URL, and you do an export and import – all the URL changes.

Cool URIs don’t change. This is also what I believe.

Leave a Reply

Your email address will not be published. Required fields are marked *