This post originated from an RSS feed registered with Web Buzz
by Vineet Manohar.
Original Post: How to trim() No-Break space ( ) when parsing HTML
Feed Title: Vineet Manohar's blog » web 2.0
Feed URL: http://www.vineetmanohar.com/category/web20/feed/
Feed Description: Web 2.0: trends, tips and tricks! Google, Google analytics, Javascript, AJAX, SEO and more...
The entity in the web pages is used to represent a blank space, but is sometimes converted to ASCII 160 (no break space), instead of ASCII 32 (space). This does not work well with Java functions like trim() which expect the ASCII 32 character (' '). This article shows you how to find and replace this character by using its unicode value and a simple regular expression.