Jump to content

Hebrew in URL sergments


Dima Mitgartz
 Share

Recommended Posts

Hi,

I need to use URL that has a segment in Hebrew, like:

example.com/blog/post/עברית

I commented out this line in .htaccess:

#RewriteCond %{REQUEST_URI} "^/~?[-_.a-zA-Z0-9/]*$"

http://example.co.il/blog/post/AAA

var_dump($input->urlSegments) returns:

string(4) "post" string(0) ""

http://example.co.il/blog/post/דש

var_dump($input->urlSegments) returns:

string(4) "post" string(3) "AAA"

Does url segments support only latin characters?

Link to comment
Share on other sites

Short answer: this isn't possible at the moment (without hacking core code, which isn't generally advisable.)

Longer answer: URL segments obey same rules as page names, i.e. roughly those set by RFC 3986 (URI scheme). You can find some discussion about this here: http://processwire.com/talk/topic/3000-non-alphabetic-page-name/. As you can see here, the behavior is identical whether we're talking about URL segments or pages: https://github.com/ryancramerdesign/ProcessWire/blob/master/wire/modules/Process/ProcessPageView.module#L141.

  • Like 1
Link to comment
Share on other sites

I managed to work around. Enabled URL segments, but used this code instead of urlSegment[n]:

explode("/", parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH));

Then I had to urldecode each segment as they have %20 characters.

Seems to work fine. Any dangers I should be aware of?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...