Interesting! I was assuming the parser to “just work” but I guess I was wrong. Assuming the EOL character depends on the OS (and browser) the bookmarks file was generated with, too. (That is, I don’t think this behavior is related to the WP version.)
Let’s see if we can hard-fork the parser library and fix this for real.
Great. My comment about the wordpress version is because the plugin shows “This plugin hasn’t been tested with the latest 3 major releases of WordPress. It may no longer be maintained or supported and may have compatibility issues when used with more recent versions of WordPress.” 😉
Yep, I didn’t explicitly test this plugin for a while (but I’ve no reason to suspect it no longer works) …
I’m wondering if instead of the proposed change, the following code change would work for you as well (line 281 of the same file):
//$sanitized = \str_replace("\r", '', $sanitized);
$sanitized = \preg_replace('~\R~u', "\n", $sanitized);
Seems (if it works) just a tad cleaner that way.
Also, kind of curious what browser/OS combination outputs (I’m assuming) \r
EOL characters rather than \n
or \r\n
…
Hi! I tried first with EOL but it doesn’t work. My browser was chrome and I save the file exported on macos last version.
Did you test my code? I’ll try to test your version, I’ll write back to you.
I did not test it yet. I mean, I trust it works, but it also skips sanitizing altogether!
Do you happen to have a bookmarks file you would want to share, for testing purposes? I’d like to investigate a bit more. Feel free to email me at jan AT janboddez DOT be.
The original code just strips \r
, which would leave \n
intact and convert \r\n
to \n
, so I can only assume there are other linebreak characters out there. The snippet I posted should convert all of them to \n
, yet leave the other sanitization functions untouched.