3

Symfony2 by default displays entity details by ID

 /**
 * Finds and displays a State entity.
 * @Route("state/{id}", name="state_show")
 * @Template()
 */

I'd like to display name of the state, but most of states contains special chars (Polish special chars).

Links work if I use {name} but it is safe to use special chars in link?

hywak
  • 890
  • 1
  • 14
  • 27
  • possible duplicate of [Characters allowed in a URL](http://stackoverflow.com/questions/1856785/characters-allowed-in-a-url) – Nic Wortel May 05 '14 at 07:27
  • Question is more about how to change special chars to regular chars in Symfony than which chars are allowed. – hywak May 05 '14 at 08:30

3 Answers3

2

Since you are not going to encode the URL, characters other than the following are unsafe.

  • alphanumeric,

  • Reserved ";", "/", "?", ":", "@", "=", "&",

  • Special characters: $-_.+!*'(),.

See this related answer.

Community
  • 1
  • 1
Armon
  • 198
  • 5
2

You can use Gedmo extensions for that, especially Sluggable.

Lkopo
  • 4,798
  • 8
  • 35
  • 60
0

In my opinion the best way (also for SEO) is to change polish letters to standard ones (for example ł => l, ą => a) and use - as words separators

Marcin Nabiałek
  • 109,655
  • 42
  • 258
  • 291