Copying print_r text from browser source code pasting with HTML-encoded chars in scratch file

If I copy a chunk of text from an HTML tag in browser source code, then create a scratch.txt file in the project, pasting the text HTML-encodes it so that something like => is converted into =&gt (equals ampersand g t).

Here's an example:

echo "<pre>RequestedThing->Parts[$partdate]: " . print_r($RequestedThing->Parts[$partdate], true) . "</pre>\n";

If I instead paste the text into another editor like TextMate, it doesn't convert any characters. If I then paste that text into the scratch file, it shows properly.

The copied text is coming from Chrome Inspect Elements, and it doesn't matter whether I copy the tag inner HTML or the just the flat text itself.

I can't tell if Chrome is just making it copy with HTML-encoded characters and TextMate is converting them, or if PHPStorm is converting them on paste but only from Chrome for some reason.

1 comment

> If I instead paste the text into another editor like TextMate, it doesn't convert any characters. 

The editor might be smart enough to covert codes into symbols on paste.

 

Try to copy the same element in Chrome, then paste in terminal or notepad++ & check the output.

I've tried your example and it got copied from Chrome with escaped symbols also:

<span class="str">"&lt;pre&gt;RequestedThing-&gt;Parts[$partdate]: "</span>

0

Please sign in to leave a comment.