java - StringEcapeUtils not working for • -


i have html string stored in database below

1&#149;day brand<sup>&#174;</sup>brand<sup>&#174;</sup>details&#151;\r\n<br>\r\n<br>\r\n<p>this brand® best needs. plus our water® technology more comfort you. brand® offers best in class mileage./p>\r\n<ul>   \r\n    <li>brand® #1 selling brand globally.\r\n    <li>experience all-day comfort water® technology.\r\n  <li>one of highest levels of mileage available in fuel.\r\n</ul> 

i reading string database in spring batch job , creating json file structure "string":"value" value whole string provided above.

now using logstash trying push json elasticsearch.when getting below error exception=>#<logstash::json::parsererror: invalid utf-8 start byte 0xae because of string ® in java while constructing json file tried using org.apache.commons.text.stringescapeutils.escapehtml4() escape char ® since have &#149; &#174; in string getting generated &amp;#149; &amp;#174 , ® coming &reg;, when use html in browser string not gettign displayed expected. thought in java first use org.apache.commons.text.stringescapeutils.unescapehtml4(ofmystring) string generated like

1day brand<sup>®</sup>brand<sup>®</sup>details<br><br><p>this brand® best needs. plus our water® technology more comfort you. brand® offers best in class mileage./p><ul>     <li>brand® #1 selling brand globally.    <li>experience all-day comfort water® technology.  <li>one of highest levels of mileage available in fuel.</ul>   

and again use escapehtml4() resolve issue. not working. issue facing here when . &#149; not displayed in html in browser. alignment missing. pfb logstash script:

input{    file {     path => ["c:/input.json"]     start_position => "beginning"     sincedb_path => "/dev/null" }}filter{ mutate {     replace => [ "message", "%{message}" ]     gsub => [ 'message','\n',''] } json { source => message } mutate{     remove_field => ["message"] }}output {    elasticsearch {             hosts => ["localhost:9200"]             index => "index"             document_type => "type"             document_id => "%{id}"    }    stdout { codec => rubydebug } } 

can please help.


Comments

Popular posts from this blog

python - Selenium remoteWebDriver (& SauceLabs) Firefox moseMoveTo action exception -

html - How to custom Bootstrap grid height? -

transpose - Maple isnt executing function but prints function term -