Skip to content

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