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

Sanitize first name in welcome message #11

Closed
jacklul opened this issue Feb 14, 2018 · 5 comments
Closed

Sanitize first name in welcome message #11

jacklul opened this issue Feb 14, 2018 · 5 comments

Comments

@jacklul
Copy link
Contributor

jacklul commented Feb 14, 2018

It seems like htmlentities is breaking for some people's names, maybe filter_var($new_user->getFirstName(), FILTER_SANITIZE_SPECIAL_CHARS) would be better? Anyone with experience in this?

@Hitmare
Copy link
Contributor

Hitmare commented Feb 14, 2018

What do you mean with breaking people's names ?

Besides, I think its a good idea to filter out special characters.

@jacklul
Copy link
Contributor Author

jacklul commented Feb 14, 2018

Per telegram documentation only those characters are supported as HTML codes: " < > &

Currently htmlentities converts all HTML characters to their html &xx; code which makes some people's names broken.

@noplanman
Copy link
Member

@jacklul Do you mean breaking like this?
welcome-message-name

I was wondering if we even need to do any encoding.

e.g. This name of special characters: ©®åß∂ƒ@ªº∆¬
without encoding: ©®åß∂ƒ@ªº∆¬
htmlentities(): &copy;&reg;&aring;&szlig;&part;&fnof;@&ordf;&ordm;∆&not;

It seems Telegram itself handles HTML code inside the name.

@jacklul
Copy link
Contributor Author

jacklul commented Feb 15, 2018

Exactly this, I don't think we need to encode other symbols than " < > & since only those are potential string breakers, right?

@noplanman
Copy link
Member

Closing this off for now...
If some other issue pops up, we can reopen.

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

No branches or pull requests

3 participants