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

Support for non alphabetical unicode characters #58

Open
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

nisanthchunduru
Copy link

Hi,

I've added support for some non alphabetical unicode characters like currency characters, math characters, symbols etc.

Previously, non alphabetical unicode characters were gobbled up

[2] pry(main)> utf8_html
=> "+<br />ー<br />〜<br />=<br />─<br />a (with double-byte space)<br />¥<br />&<br />%<br />#<br />$<br />!<br />?<br />><<br />・<br />/<br />「」<br />@<br />、。"
[3] pry(main)> TruncateHtml::HtmlTruncator.new(TruncateHtml::HtmlString.new(utf8_html), length: 1000).truncate
=> "<br />ー<br />〜<br /><br /><br />a(with double-byte space)<br /><br />&<br />%<br />#<br /><br />!<br />?<br /><br />・<br />/<br />「」<br />@<br />、。"

Now

[2] pry(main)> utf8_html
=> "+<br />ー<br />〜<br />=<br />─<br />a (with double-byte space)<br />¥<br />&<br />%<br />#<br />$<br />!<br />?<br />><<br />・<br />/<br />「」<br />@<br />、。"
[3] pry(main)> TruncateHtml::HtmlTruncator.new(TruncateHtml::HtmlString.new(utf8_html), length: 1000).truncate
=> "+<br />ー<br />〜<br />=<br />─<br />a (with double-byte space)<br />¥<br />&<br />%<br />#<br />$<br />!<br />?<br />><<br />・<br />/<br />「」<br />@<br />、。"

@crv
Copy link

crv commented Nov 25, 2015

This is useful. @nisanth074 Can you also add temperature degree symbol (e.g. °C) in the list of your special characters ?

@wwcline
Copy link

wwcline commented Mar 17, 2016

This might (at least partly) resolve #35.

@rob-mcgrail
Copy link

Is this going to be merged?

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

Successfully merging this pull request may close these issues.

5 participants