# Automatische Kodierung der geparsten URL-Parameter

**URL:** <https://meta.discourse.org/t/automatic-encoding-of-parsed-url-params/67232>\
**Category:** Development\
**Created:** [1. August 2017 um 09:53 UTC](https://meta.discourse.org/t/automatic-encoding-of-parsed-url-params/67232 "2017-08-01T09:53:48Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![Alavi1412](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/alavi1412/32/67721_2.png) [@Alavi1412](https://meta.discourse.org/u/Alavi1412)\
**Post date:** [3. August 2017 um 07:17 UTC](https://meta.discourse.org/t/automatic-encoding-of-parsed-url-params/67232/4 "2017-08-03T07:17:40Z")

</div>

I know rails a little and I have some Idea.

this code in topic controller is not working well. As I tested some `puts` in console. I have find out that this part of topic controller has some problem. And I found out that there is no extra whitespace after this.  
`params[:slug]`

I have tested some codes to find out if there is extra whitespace after slug or not. so I added the following to topic\_controller:

```plaintext
puts "'#{params[:slug]}'"
puts params[:slug].length
puts "'#{@topic_view.topic.slug}'"
puts @topic_view.topic.slug.length

```

and the out put was this:

```plaintext
'مشکل-پیدا-کردن-ترجمه-ی-خوب'
47
'مشکل-پیدا-کردن-ترجمه-ی-خوب'
26

```

I added a single quotation around the out put to see whatespace in console there is no whitespace between the slug and the single quotation. the are exactly the same but the length is diffrent.

UPDATE:  
look at the code I have changed and the output:

code:

```plaintext
      puts "'#{params[:slug]}'"
      puts params[:slug].length
      puts params[:slug].encoding
      puts "'#{@topic_view.topic.slug}'"
      puts @topic_view.topic.slug.length
      puts @topic_view.topic.slug.encoding

```

output:

```plaintext
'مشکل-پیدا-کردن-ترجمه-ی-خوب'
47
ASCII-8BIT
'مشکل-پیدا-کردن-ترجمه-ی-خوب'
26
UTF-8

```

---

_[View the full topic](https://meta.discourse.org/t/automatic-encoding-of-parsed-url-params/67232)._
