jpratt Posted June 5, 2009 Share Posted June 5, 2009 I am connecting to an email account, reading its contents and placing it in a database. everything looks good but some of the text comes formated strange. some of it looks like this: I use the fine-cut nozzles on my Hyperthreme 1250. I am having the same pro= blem on=20 As you can see it cuts off sentences midword, places an = sign, and end of sentences it places and =20. Does anyone know what causes this? I tried a few different string functions on it to clear it up, but nothing helped. Can someone give me an idea what is going on? Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/161100-solved-strange-text-formatting/ Share on other sites More sharing options...
gijew Posted June 5, 2009 Share Posted June 5, 2009 Do you have htmlentities on there anywhere. I know (think) %20 is for spaces so perhaps it's trying to parse out some entities and it's getting scrambled along the way. Weird. Quote Link to comment https://forums.phpfreaks.com/topic/161100-solved-strange-text-formatting/#findComment-850226 Share on other sites More sharing options...
jpratt Posted June 5, 2009 Author Share Posted June 5, 2009 I do have the following as the message is coming into the db: $text = htmlspecialchars($text, ENT_QUOTES); The strange thing is that it only does it to some emails coming in but not all. Quote Link to comment https://forums.phpfreaks.com/topic/161100-solved-strange-text-formatting/#findComment-850229 Share on other sites More sharing options...
BobcatM Posted June 5, 2009 Share Posted June 5, 2009 Not real sure what's going on, might try posting some code? On a side note, I used a Hypertherm 1250 today haha.. Quote Link to comment https://forums.phpfreaks.com/topic/161100-solved-strange-text-formatting/#findComment-850230 Share on other sites More sharing options...
gijew Posted June 5, 2009 Share Posted June 5, 2009 Try using htmlentities() instead. See if that clears it up. Do you have the encoding set on the page? Perhaps they are coming from non-english users and that's screwing it up. Dunno... Quote Link to comment https://forums.phpfreaks.com/topic/161100-solved-strange-text-formatting/#findComment-850231 Share on other sites More sharing options...
jpratt Posted June 5, 2009 Author Share Posted June 5, 2009 I found the reason. Some of the emails were coming in as quoted printable strings. There are two functions that decode this. http://uk2.php.net/manual/en/function.quoted-printable-decode.php and if using the imap module for email: http://uk2.php.net/manual/en/function.imap-qprint.php I use the imap module to get my email so I will probably just work that into my class. Thanks for all the suggestions. Quote Link to comment https://forums.phpfreaks.com/topic/161100-solved-strange-text-formatting/#findComment-850252 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.