diff --git a/Language/Java/Pretty.hs b/Language/Java/Pretty.hs
--- a/Language/Java/Pretty.hs
+++ b/Language/Java/Pretty.hs
@@ -1,6 +1,7 @@
 module Language.Java.Pretty where
 
 import Text.PrettyPrint
+import Text.Printf (printf)
 import Data.Char (toLower)
 import Data.List (intersperse)
 
@@ -363,8 +364,8 @@
   prettyPrec p (Float f) = text (show f) <> char 'F'
   prettyPrec p (Double d) = text (show d)
   prettyPrec p (Boolean b) = text . map toLower $ show b
-  prettyPrec p (Char c) = text (show c)
-  prettyPrec p (String s) = text (show s)
+  prettyPrec p (Char c) = quotes $ text (escapeChar c)
+  prettyPrec p (String s) = doubleQuotes $ text (concatMap escapeString s)
   prettyPrec p (Null) = text "null"
 
 instance Pretty Op where
@@ -562,3 +563,26 @@
 opPrec Or      = 10
 opPrec CAnd    = 11
 opPrec COr     = 12
+
+escapeGeneral :: Char -> String
+escapeGeneral '\b' = "\\b"
+escapeGeneral '\t' = "\\t"
+escapeGeneral '\n' = "\\n"
+escapeGeneral '\f' = "\\f"
+escapeGeneral '\r' = "\\r"
+escapeGeneral '\\' = "\\\\"
+escapeGeneral c | c >= ' ' && c < '\DEL' = [c]
+                | c <= '\xFFFF' = printf "\\u%04x" (fromEnum c)
+                | otherwise = error $ "Language.Java.Pretty.escapeGeneral: Char " ++ show c ++ " too large for Java char"
+
+escapeChar :: Char -> String
+escapeChar '\'' = "\\'"
+escapeChar c = escapeGeneral c
+
+escapeString :: Char -> String
+escapeString '"' = "\\\""
+escapeString c | c <= '\xFFFF' = escapeGeneral c
+               | otherwise = escapeGeneral lead ++ escapeGeneral trail
+                   where c' = fromEnum c - 0x010000
+                         lead = toEnum $ 0xD800 + c' `div` 0x0400
+                         trail = toEnum $ 0xDC00 + c' `mod` 0x0400
diff --git a/dist/build/Language/Java/Lexer.hs b/dist/build/Language/Java/Lexer.hs
--- a/dist/build/Language/Java/Lexer.hs
+++ b/dist/build/Language/Java/Lexer.hs
@@ -123,11 +123,11 @@
                               in p' `seq`  Just (b, (p', c, bs, s))
 
 
-{-# LINE 89 "templates/wrappers.hs" #-}
+{-# LINE 92 "templates/wrappers.hs" #-}
 
-{-# LINE 103 "templates/wrappers.hs" #-}
+{-# LINE 106 "templates/wrappers.hs" #-}
 
-{-# LINE 118 "templates/wrappers.hs" #-}
+{-# LINE 121 "templates/wrappers.hs" #-}
 
 -- -----------------------------------------------------------------------------
 -- Token positions
@@ -155,29 +155,29 @@
 -- -----------------------------------------------------------------------------
 -- Default monad
 
-{-# LINE 231 "templates/wrappers.hs" #-}
+{-# LINE 242 "templates/wrappers.hs" #-}
 
 
 -- -----------------------------------------------------------------------------
 -- Monad (with ByteString input)
 
-{-# LINE 320 "templates/wrappers.hs" #-}
+{-# LINE 333 "templates/wrappers.hs" #-}
 
 
 -- -----------------------------------------------------------------------------
 -- Basic wrapper
 
-{-# LINE 347 "templates/wrappers.hs" #-}
+{-# LINE 360 "templates/wrappers.hs" #-}
 
 
 -- -----------------------------------------------------------------------------
 -- Basic wrapper, ByteString version
 
-{-# LINE 365 "templates/wrappers.hs" #-}
-
 {-# LINE 378 "templates/wrappers.hs" #-}
 
+{-# LINE 392 "templates/wrappers.hs" #-}
 
+
 -- -----------------------------------------------------------------------------
 -- Posn wrapper
 
@@ -189,7 +189,7 @@
   where go inp@(pos,_,_,str) =
           case alexScan inp 0 of
                 AlexEOF -> []
-                AlexError ((AlexPn _ line column),_,_,_) -> error $ "lexical error at " ++ (show line) ++ " line, " ++ (show column) ++ " column"
+                AlexError ((AlexPn _ line column),_,_,_) -> error $ "lexical error at line " ++ (show line) ++ ", column " ++ (show column)
                 AlexSkip  inp' len     -> go inp'
                 AlexToken inp' len act -> act pos (take len str) : go inp'
 
@@ -198,7 +198,7 @@
 -- -----------------------------------------------------------------------------
 -- Posn wrapper, ByteString version
 
-{-# LINE 410 "templates/wrappers.hs" #-}
+{-# LINE 424 "templates/wrappers.hs" #-}
 
 
 -- -----------------------------------------------------------------------------
@@ -588,11 +588,22 @@
 -- -----------------------------------------------------------------------------
 -- INTERNALS and main scanner engine
 
-{-# LINE 35 "templates/GenericTemplate.hs" #-}
+{-# LINE 21 "templates/GenericTemplate.hs" #-}
 
-{-# LINE 45 "templates/GenericTemplate.hs" #-}
 
 
+
+
+#if __GLASGOW_HASKELL__ > 706
+#define GTE(n,m) (tagToEnum# (n >=# m))
+#define EQ(n,m) (tagToEnum# (n ==# m))
+#else
+#define GTE(n,m) (n >=# m)
+#define EQ(n,m) (n ==# m)
+#endif
+{-# LINE 50 "templates/GenericTemplate.hs" #-}
+
+
 data AlexAddr = AlexA# Addr#
 
 #if __GLASGOW_HASKELL__ < 503
@@ -709,7 +720,7 @@
                 offset = (base +# ord_c)
                 check  = alexIndexInt16OffAddr alex_check offset
 		
-                new_s = if (offset >=# 0#) && (check ==# ord_c)
+                new_s = if GTE(offset,0#) && EQ(check,ord_c)
 			  then alexIndexInt16OffAddr alex_table offset
 			  else alexIndexInt16OffAddr alex_deflt s
 	in
@@ -725,7 +736,7 @@
 	check_accs (AlexAccNone) = last_acc
 	check_accs (AlexAcc a  ) = AlexLastAcc a input (I# (len))
 	check_accs (AlexAccSkip) = AlexLastSkip  input (I# (len))
-{-# LINE 191 "templates/GenericTemplate.hs" #-}
+{-# LINE 196 "templates/GenericTemplate.hs" #-}
 
 data AlexLastAcc a
   = AlexNone
@@ -741,7 +752,7 @@
   = AlexAccNone
   | AlexAcc a
   | AlexAccSkip
-{-# LINE 235 "templates/GenericTemplate.hs" #-}
+{-# LINE 240 "templates/GenericTemplate.hs" #-}
 
 -- used by wrappers
 iUnbox (I# (i)) = i
diff --git a/language-java.cabal b/language-java.cabal
--- a/language-java.cabal
+++ b/language-java.cabal
@@ -1,5 +1,5 @@
 Name:                   language-java
-Version:                0.2.5
+Version:                0.2.6
 License:                BSD3
 License-File:           LICENSE
 Author:                 Niklas Broberg
