Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

escape emojis when encodeUriCOmponent on geo #117

Closed
michelson opened this issue Apr 7, 2015 · 7 comments
Closed

escape emojis when encodeUriCOmponent on geo #117

michelson opened this issue Apr 7, 2015 · 7 comments

Comments

@michelson
Copy link
Contributor

it seems that ssid with emojis are generating errors when the url is encoded:

 critical Tue, 07 Apr 2015 16:28:27 GMT UNCAUGHT EXCEPTION: URI malformed
 debug Tue, 07 Apr 2015 16:28:27 GMT URIError: URI malformed

the offending line is in geo/index.js 40

var str = 'wifi=mac:' + ap.mac_address + '|ssid:' + encodeURIComponent(ap.ssid);

I tried to escape the the ssid and it works , but the emoji is removed.

var str = 'wifi=mac:' + ap.mac_address + '|ssid:' + encodeURIComponent(escape(ap.ssid));
@tomas
Copy link
Contributor

tomas commented Apr 7, 2015

What OS? AFAIR we were sanitizing SSID names on get_access_points_list.

@mauricioschneider
Copy link
Contributor

Here's how to reproduce:

screen shot 2015-04-07 at 1 55 19 pm

The original SSID for testing is: 👍💓la mejor wifa

@mauricioschneider
Copy link
Contributor

screen-shot-2015-04-07-at-1 56 41-pm

@mauricioschneider
Copy link
Contributor

Here's some info on the proposed solution by @michelson

http://ecmanaut.blogspot.com/2006/07/encoding-decoding-utf8-in-javascript.html

@mauricioschneider
Copy link
Contributor

After some debugging, @tomas found out that what's causing the problem is that the regex is missing the g modifier.

@mauricioschneider
Copy link
Contributor

According to my testings, this is only reproducible in Mac OS X. Linux and Windows are escaping the emojis correctly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants