summaryrefslogtreecommitdiff
path: root/inc/parser
diff options
context:
space:
mode:
authorAndreas Gohr <andi@splitbrain.org>2014-09-27 14:08:37 +0200
committerAndreas Gohr <andi@splitbrain.org>2014-09-27 14:08:37 +0200
commitece4159b488ee81a13b9122239c88d82ec1aa59c (patch)
treef17577ffb84346e84df0945fa92c6f5634c7df68 /inc/parser
parentda9572711f54d13ce3c5506971154b0bc359723f (diff)
downloadrpg-ece4159b488ee81a13b9122239c88d82ec1aa59c.tar.gz
rpg-ece4159b488ee81a13b9122239c88d82ec1aa59c.tar.bz2
Send CRLF to Windows UAs for code blocks #863
Diffstat (limited to 'inc/parser')
-rw-r--r--inc/parser/code.php5
1 files changed, 5 insertions, 0 deletions
diff --git a/inc/parser/code.php b/inc/parser/code.php
index 00b956c27..2353e0dfa 100644
--- a/inc/parser/code.php
+++ b/inc/parser/code.php
@@ -21,6 +21,11 @@ class Doku_Renderer_code extends Doku_Renderer {
$filename = utf8_basename($filename);
$filename = utf8_stripspecials($filename, '_');
+ // send CRLF to Windows clients
+ if(strpos($INPUT->server->str('HTTP_USER_AGENT'), 'Windows') !== false) {
+ $text = str_replace("\n", "\r\n", $text);
+ }
+
if($this->_codeblock == $INPUT->str('codeblock')) {
header("Content-Type: text/plain; charset=utf-8");
header("Content-Disposition: attachment; filename=$filename");