php - How do you fix sentence spacing on extracted plain text from HTML? -
i'm pulling articles specific urls conversion sentences, text body has random behavior of eliminating whitespace between sentences resulting in:
jane went store.she bought dog. dog friendly.it had no teeth.
some of text stock symbols (az.gan) etc. can't insert space between periods have no adjacent whitespace.
jane bought several shares of (ty.jpn). lost cash money."arg!" cried.
the above example destroy stock symbol variable.
curious if knows cause of this. have tried several html , dom. use simple_dom grab plaintext. although, same result if manually, or other parsing engine.
unfortunately don't have approach specific question, possible missing space between sentences linebreak (e.g. \n) text viewer (whatever is) isn't showing you?
perhaps try make sure
var articlecontent = ... // content
articlecontent = articlecontent.replace(/\n/g, ' new line ');
Comments
Post a Comment