diff --git a/Text/XML/Light/Lexer.hs b/Text/XML/Light/Lexer.hs
--- a/Text/XML/Light/Lexer.hs
+++ b/Text/XML/Light/Lexer.hs
@@ -4,7 +4,7 @@
 
 import Text.XML.Light.Types
 
-import Data.Char (chr,isSpace,ord)
+import Data.Char (chr,isSpace)
 import Numeric (readHex)
 import qualified Data.ByteString      as S
 import qualified Data.ByteString.Lazy as L
diff --git a/Text/XML/Light/Output.hs b/Text/XML/Light/Output.hs
--- a/Text/XML/Light/Output.hs
+++ b/Text/XML/Light/Output.hs
@@ -177,7 +177,9 @@
   '\''  -> showString "&#39;"
   -- XXX: Is this really wortherd?
   -- We could deal with these issues when we convert characters to bytes.
-  _ | (oc <= 0x7f && isPrint c) || c == '\n' || c == '\r' -> showChar c
+  -- NOTE: We escape '\r' explicitly because otherwise they get lost
+  -- when parsed back in because of then end-of-line normalization rules.
+  _ | (oc <= 0x7f && isPrint c) || c == '\n' -> showChar c
     | otherwise -> showString "&#" . shows oc . showChar ';'
       where oc = ord c
 
diff --git a/xml.cabal b/xml.cabal
--- a/xml.cabal
+++ b/xml.cabal
@@ -1,5 +1,5 @@
 Name:            xml
-Version:         1.3.8
+Version:         1.3.9
 Homepage:        http://code.galois.com
 Synopsis:        A simple XML library.
 Description:     A simple XML library.
