Sorry typo of subject, it should be: Rules for creating a url alias after node created not support chinese character

here is the rule

{ "rules_interview_alias" : {
    "LABEL" : "interview_alias",
    "PLUGIN" : "reaction rule",
    "REQUIRES" : [ "rules", "path" ],
    "ON" : [ "node_insert" ],
    "IF" : [
      { "node_is_of_type" : {
          "node" : [ "node" ],
          "type" : { "value" : { "interview" : "interview" } }
        }
      }
    ],
    "DO" : [
      { "node_path_alias" : { "node" : [ "node" ], "alias" : "[node:nid][node:title].html" } }
    ]
  }
}

if node:title contains chinese character, the final url will be [node:nid].html, [node:title] is skipped

How do solved this problem?

Comments

hkvega01’s picture

Title: Create a rules after created a node not support chinese character » Rules for creating a url alias after node created not support chinese character
ptmkenny’s picture

Status: Active » Postponed (maintainer needs more info)

Does the [node:title] token properly output Chinese characters?

Can you normally create URLs with aliases that contain Chinese characters on your site?

hkvega01’s picture

Does the [node:title] token properly output Chinese characters?
>>really don't know

Can you normally create URLs with aliases that contain Chinese characters on your site?
>>YES, but not using rules

ptmkenny’s picture

Try adding another action to the rule, "Show message on site," and set the message to "[node:nid][node:title].html" and check what is output. Also, enable the rules debug log and give permission to view the debug log results and see what that outputs.

ptmkenny’s picture

Issue summary: View changes

typo of subject

tr’s picture

Category: Bug report » Support request
Issue summary: View changes
Status: Postponed (maintainer needs more info) » Fixed

By default, the node_path_alias action uses transliteration (if the transliteration module is available) then replaces all non-ASCII characters with a "-", but this can be changed.

Go to /admin/config/workflow/rules/settings and you will see an option "URL Path cleaning method". The default value is "Rules (built-in) which
replaces non-ASCII characters like I describe above. But if you use "Pathauto" (requires Pathauto module) as your path cleaning method, then it will properly display Chinese characters.

Note, this is NOT a problem with Tokens - they will work properly with Chinese characters in most contexts. But a path is special, and the character set for paths is restricted by the HTTP protocol (and was far more restricted on the internet when this code was first written), which is why there is a "cleaning function".

Because you can configure this to work, I don't consider it a bug. Perhaps the default Rules path cleaning function should be brought up to current web standards for which characters can and cannot appear in a path.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.