[wp-trac] [WordPress Trac] #9716: WordPress Theme/Plugin editor adds blank lines
WordPress Trac
wp-trac at lists.automattic.com
Fri Apr 20 16:29:43 UTC 2012
#9716: WordPress Theme/Plugin editor adds blank lines
-------------------------------------+-----------------------------
Reporter: Vistronic | Owner: anonymous
Type: defect (bug) | Status: reopened
Priority: normal | Milestone: Future Release
Component: Editor | Version: 2.7.1
Severity: normal | Resolution:
Keywords: has-patch needs-testing |
-------------------------------------+-----------------------------
Comment (by mbijon):
I like the approach of doing this in WP, instead of with fopen. And, I
know that convention is to never change a user's file, but for mixed line-
endings I think we have to.
In general I've always heard that \n is the "universal" line ending.
There's already a long-standing decision to use \n newlines in wpautop():
{{{$pee = str_replace(array("\r\n", "\r"), "\n", $pee); // cross-platform
newlines}}}
Admittedly that's applied to content & not files. Though files & content
are rendered by the browser, and the above works globally there. Meanwhile
all modern editors do newline detection & replacement (and have settings
for it), and I'm really against adding newline options to WP.
As for not being able to replicate this bug, it's specific to the
combination of browser and server (possibly even some PHP config settings
like language or Unicode). I've never seen it on WordPress, but have on
other systems (one running on an enterprise Java/Solaris stack). It could
be from Windows-based IE & Opera doing a transformation from \n to \r\n
internally, http://stackoverflow.com/questions/1155678/javascript-string-
newline-character/1156388#1156388
--
Ticket URL: <http://core.trac.wordpress.org/ticket/9716#comment:21>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list