#160 closed enhancement (duplicate)
While sanitize_title() returns a empty string...
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 1.2 |
Component: | General | Keywords: | |
Focuses: | Cc: |
Description
The sanitize_title() function of WordPress 1.2 can not handle No-English characters well, especially the Asian characters such as Chinese, Japanese and Korean. If you generate a post-slug with a Chinese entry title, the post-slug will be all blank. However, WP system does not check such situation. For example, in post.php, it says:
<?php
if (empty($post_name))
$post_name = sanitize_title($post_title);
else
$post_name = sanitize_title($post_name);
The developers may not notice that after this progress, the $post_name maybe still empty. Its an annoying problem for Non-English users to use the permalink function of WordPress. Althoght you can set the post-slug manually, you can not alter the $category_nicename of each category and $user_niceame for the authors. I think there must be more checks, for example, I added some codes to the post.php:
<?php
if (empty($post_name))
$post_name = sanitize_title($post_title);
else
$post_name = sanitize_title($post_name);
if (empty($post_name)) {
$post_ID = $wpdb->get_var("SELECT ID FROM $tableposts ORDER BY ID DESC LIMIT 1″);
$post_name = "post-".$post_ID + 1;
}
If the $post_name is still empty after filling the sanitized data, just fill in something somehow. I filled it with the ID of each post just because each blog entry must have an ID. I hope that the official developers may notice this problem and contain some solution to solve this problem in the very next release.