# Redirecionamento SSO falha para caracteres não latinos

**URL:** <https://meta.discourse.org/t/sso-redirect-fails-for-non-latin-chars/101632>\
**Category:** WordPress\
**Created:** [Novembro 8, 2018, 8:29pm UTC](https://meta.discourse.org/t/sso-redirect-fails-for-non-latin-chars/101632 "2018-11-08T20:29:21Z")\
**Posts on this page:** 1\
**Showing post:** 7

<div class="post-metadata">

**Author:** ![Arkshine](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/arkshine/32/298682_2.png) [@Arkshine](https://meta.discourse.org/u/Arkshine)\
**Post date:** [Novembro 30, 2018, 9:04pm UTC](https://meta.discourse.org/t/sso-redirect-fails-for-non-latin-chars/101632/7 "2018-11-30T21:04:15Z")

</div>

@gerald is right, the plugin does not deal properly with URL and Unicode characters. I’m helping him on this matter.

After investigating, it seems you need to encode properly the URL before sending the request: [wp-discourse/lib/sso-client/query-redirect.php at main · discourse/wp-discourse · GitHub](https://github.com/discourse/wp-discourse/blob/master/lib/sso-client/query-redirect.php#L87-L99)  
Possible and working suggestion: `utf8_uri_encode($redirect_to)`  
If you don’t encode, Discourse will not be happy and will error that URI must be ASCII only.

Another place to fix is when the plugin receives the response: [wp-discourse/lib/sso-client/client.php at main · discourse/wp-discourse · GitHub](https://github.com/discourse/wp-discourse/blob/master/lib/sso-client/client.php#L382-L388)  
I’m not totally sure why `urldecode` and `sanitize_text_field` is used before the string is decoded, but once decoded, the `sanitize_text_field` call on the URL will strip all the encoded characters.  
Possible suggestion: `urldecode` needs to be called before.

So far, those fixes seem to fix the issue gerald had.

---

_[View the full topic](https://meta.discourse.org/t/sso-redirect-fails-for-non-latin-chars/101632)._
