Reputation: 123
I have been attempting to parse a file. In Notepad++ it doesn't show a character between these two characters, it shows EOT: Notepad Text
But, php doesn't see that: PHP Text
Is there a reason PHP is not seeing this character? How do I get it to see said character and turn it into a line break? Thanks in advance.
Upvotes: 0
Views: 258
Reputation:
EOT is a control character. When output to a web browser, there is no matching glyph, so nothing to output.
If you output the ascii value of each position of the string, or the length of the string, you'll likely find that the character is still there.
http://en.wikipedia.org/wiki/End-of-transmission_character
If you want to change EOT into a line break, you could likely loop over the string checking for non-letter ASCII values and replacing them with a return character. Then use PHP's nl2br() function before output to convert newlines into a line break.
Untested code:
for ($i = 0; i < count($string); $i++){
if(ord($string[$i]) == 4)$string[$i] = '\n';
}
ASCII 4 is EOT, ASCII 13 is Carriage Return, better know as Newline.
Upvotes: 1