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

htmlspecialchars() equivalent #162

Open
d9k opened this issue Mar 31, 2018 · 4 comments
Open

htmlspecialchars() equivalent #162

d9k opened this issue Mar 31, 2018 · 4 comments

Comments

@d9k
Copy link

d9k commented Mar 31, 2018

I asked this question at sailor chat but no one answered.

How to html encode in sailor? For example if you want to output string variable which contains double quotes character into html tag argument value?

Example usage: <input value="<?= htmlspecialchars(myvariable) ?> " > (function must be available at templates (.lp) files)

See php documentation for similar function: http://php.net/manual/en/function.htmlspecialchars.php

@max-bertinetti
Copy link

Lua page are different from PHP. See this:
https://keplerproject.github.io/cgilua/manual.html#templates
If this knowledge let you do what you need then ok.
Or try with this module:
https://github.com/TiagoDanin/htmlEntities-for-lua/blob/master/README.md

@d9k
Copy link
Author

d9k commented Apr 5, 2018

@CodelessFuture, thanks a lot, but htmlEntities.encode(s) doesn't encode double quote " into &quot; as expected!

Created and issue at htmlEntities project too:
TiagoDanin/htmlEntities-for-lua#6

@d9k
Copy link
Author

d9k commented Apr 6, 2018

maintainer of htmlEntities-for-lua fixed an issue, thanks him a lot!
@CodelessFuture, now the question is would sailor framework include dependency to htmlEntities?
And html_encode function must be available at the templates by default, I think...

@max-bertinetti
Copy link

Hi. I'm having some trouble at work in this period. I think I can dedicate my time at Sailor again for the end of this month.

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

2 participants