Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Document new utf8 option of Routing component#6938

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
wouterj merged 1 commit intosymfony:masterfrommickaelandrieu:patch-4
Oct 6, 2016

Conversation

@mickaelandrieu
Copy link
Contributor

@nicolas-grekas
Copy link
Member

See#6890
we now have to decide which one is better :)

@nicolas-grekas
Copy link
Member

or merge both since they aren't on the same page

@mickaelandrieu
Copy link
ContributorAuthor

mickaelandrieu commentedSep 1, 2016
edited
Loading

@nicolas-grekas my bad, didnt thank you have started something... as you like, I wont be sad if you close this one, my only interest is to see this feature documented ^^

By the way, big thanks! From a business/e-commerce point of view, this feature is so useful :)

are saved in the ``cache_dir``. This means your script must have write
permissions for that location.

Unicode routing support
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Unicode Routing Support

Unicode routing support
~~~~~~~~~~~~~~~~~~~~~~~

The routing component supports UTF-8 characters in route paths and requirements. Thanks to the `utf8` route option, you can make Symfony match and generate routes with UTF-8 characters:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Routing component

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

The option needs to be enclosed by double backticks.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Please also wrap lines after the first word that crosses the 72nd character.

requirements:
name:".+"
options:
utf8:true
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Please add Annotations, XML, and PHP examples too.

options:
utf8:true
In this route, the `utf8` option set to true makes Symfony consider the `.` requirement to match any UTF-8 characters instead of just a single byte character, so the following URLs would match: `/category/日本語`, `/category/فارسی`, `/category/한국어`, etc. In case you are wondering, this option also allows to include and match emojis in URLs.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

please use double backticks everywhere here too

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

and please wrap lines after the first word that crosses the 72nd character

requirements:
default:"日本語|فارسی"
options:
utf8:true
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

We need other format examples here too.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Do we really need ? I don't see the gain here when it's already well describedhere

I will do it if you insist, though (sounds like a simple copy/paste of the resource I've linked ^ ).

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

That's how the doc is yes, config are always in all formats, repeating is teaching isn't it?

xabbuh reacted with thumbs up emoji
Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

true, let's go for it :)

options:
utf8:true
This second example describes how you can use utf8 string as a routing requirement.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

UTF-8


..note::

In Symfony 3.2 there is no need to set this utf8 explicitly. As soon as Symfony finds a UTF-8 character in the route path or requirements, it will turn the UTF-8 support automatically. In addition to UTF-8 characters, the Routing component also supports all the `PCRE Unicode properties`_, which are escape sequences that match generic character types. For example, `\p{Lu}` matches any uppercase character in any language, `\p{Greek}` matches any Greek character, `\P{Han}` matches any character not included in the Chinese Han script.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

same as above

In Symfony 3.2 there is no need to set this utf8 explicitly. As soon as Symfony finds a UTF-8 character in the route path or requirements, it will turn the UTF-8 support automatically. In addition to UTF-8 characters, the Routing component also supports all the `PCRE Unicode properties`_, which are escape sequences that match generic character types. For example, `\p{Lu}` matches any uppercase character in any language, `\p{Greek}` matches any Greek character, `\P{Han}` matches any character not included in the Chinese Han script.

..versionadded::3.2
The UTF8 support in route paths and requirements were added in Symfony 3.2
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

UTF-8 support for route paths and requirements were introduced in Symfony 3.2.

@mickaelandrieu
Copy link
ContributorAuthor

Wow ... I feel so bad :( thank you for this review, I will address comments tomorrow!

@xabbuh
Copy link
Member

No need to worry. There's not much to change. :)

@mickaelandrieu
Copy link
ContributorAuthor

Hi@xabbuh,

I've adressed almost all comments except the one about complete all formats, let me know if this need more work :)

Mickaël

@xabbuh
Copy link
Member

👍 (except for the missing config formats)

<routeid="route1"path="/category/{name}">
<defaultkey="_controller">AppBundle:Default:category</default>
<optionkey="utf8">true</option>
Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Question here: how can we do to ensure true will be converted to boolean value ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

That's the responsibility of the loader.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

So ... is it good, or does it need much work from me ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

It's good as it is. :)

are saved in the ``cache_dir``. This means your script must have write
permissions for that location.

Unicode Routing support
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Support

path:/category/{name}
defaults:{ _controller: 'DefaultController::categoryAction' }
options:
utf8:true
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

please indent this line with four spaces

# routes.yml
route1:
path:/category/{name}
defaults:{ _controller: 'DefaultController::categoryAction' }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

AppBundle:Default:category

return $collection;
In this route, the ``utf8`` option set to true makes Symfony consider the
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

please enclosetrue in double backticks

In this route, the ``utf8`` option set to true makes Symfony consider the
``.`` requirement to match any UTF-8 characters instead of just a single
byte character, so the following URLs would match: ``/category/日本語``,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

maybe split this here: "[...] character. This means that the following URL would match [...]"


..configuration-block::

..code-block::php-annotations
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

please indent with four spaces

return $collection;
This second example describes how you can use UTF-8 string as a routing
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

strings

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

[...] as routing requirements.


..note::

In Symfony 3.2 there is no need to set this utf8 explicitly. As soon
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

[...] to explicitly set theutf8 option.


..versionadded::3.2
UTF-8 support for route paths and requirements were introduced in
Symfony 3.2.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I would move this up to the beginning of this section.

@mickaelandrieumickaelandrieuforce-pushed thepatch-4 branch 2 times, most recently frombbd2931 to19a864fCompareSeptember 27, 2016 21:07
@mickaelandrieu
Copy link
ContributorAuthor

@xabbuh thanks again for your time. Comments addressed ;)

~~~~~~~~~~~~~~~~~~~~~~~

..versionadded::3.2
UTF-8 support for route paths and requirements were introduced in
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

was

path:/category/{name}
defaults:{ _controller: 'AppBundle:Default:category' }
options:
utf8:true
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

indentation :)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Looks like it's the same in the other YAML example too.

@xabbuh
Copy link
Member

@mickaelandrieu I left two last minor comments and indentation of the PHP code examples looks weird too. But overall this change looks ready to be merged. 👍

@mickaelandrieu
Copy link
ContributorAuthor

mickaelandrieu commentedSep 28, 2016
edited
Loading

@xabbuh I won't give up now :D let me improve again my contribution ;)

edit: comments addressed (and PHP code cs fixed)

@xabbuh
Copy link
Member

👍

Status: Reviewed

mickaelandrieu reacted with heart emoji

@wouterjwouterj merged commit2569aca intosymfony:masterOct 6, 2016
wouterj added a commit that referenced this pull requestOct 6, 2016
…ndrieu)This PR was merged into the master branch.Discussion----------Document new utf8 option of Routing componentHi,all credits to@javiereguiluz and@nicolas-grekas, I've just copy/pasted the blog articlehttp://symfony.com/blog/new-in-symfony-3-2-unicode-routing-support#comment-formMickaëlCommits-------2569aca Document new utf8 option of Routing component
@wouterj
Copy link
Member

Thanks@mickaelandrieu! After your quick responses to the reviews, this PR has now made it to the docs!

Fyi, I've fixed some indentation issues and splitted the big note directive inc5328d7.

@mickaelandrieu
Copy link
ContributorAuthor

@wouterj thank you, it's better now :)
Always happy to help ;)

xabbuh reacted with thumbs up emoji

@mickaelandrieumickaelandrieu deleted the patch-4 branchOctober 6, 2016 23:31
xabbuh added a commit to xabbuh/symfony-docs that referenced this pull requestOct 7, 2016
wouterj added a commit that referenced this pull requestOct 20, 2016
This PR was merged into the master branch.Discussion----------[#6938] tweak the wording a bitCommits-------9348ccf [#6938] tweak the wording a bit
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@nicolas-grekasnicolas-grekasnicolas-grekas left review comments

@xabbuhxabbuhxabbuh approved these changes

Assignees

No one assigned

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

5 participants

@mickaelandrieu@nicolas-grekas@xabbuh@wouterj@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp