diff --git a/cgi/texmath-cgi.hs b/cgi/texmath-cgi.hs
--- a/cgi/texmath-cgi.hs
+++ b/cgi/texmath-cgi.hs
@@ -5,10 +5,11 @@
 import Data.Maybe (fromMaybe)
 import Control.Monad
 import Text.JSON
+import Codec.Binary.UTF8.String (decodeString)
 
 cgiMain :: CGI CGIResult
 cgiMain = do
-  latexFormula <- liftM (fromMaybe "") $ getInput "latexFormula"
+  latexFormula <- liftM (decodeString . fromMaybe "") $ getInput "latexFormula"
   setHeader "Content-type" "text/xhtml; charset=UTF-8"
   output . encodeStrict $
     case texMathToMathML DisplayBlock latexFormula of
diff --git a/texmath.cabal b/texmath.cabal
--- a/texmath.cabal
+++ b/texmath.cabal
@@ -1,5 +1,5 @@
 Name:                texmath
-Version:             0.3
+Version:             0.3.0.1
 Cabal-version:       >= 1.2
 Build-type:          Custom
 Synopsis:            Conversion of LaTeX math formulas to MathML.
@@ -77,6 +77,7 @@
 
 Executable texmath-cgi
     Main-is:             cgi/texmath-cgi.hs
+    Build-depends:       utf8-string
     Ghc-Options:         -Wall -fno-warn-unused-do-bind
     Ghc-Prof-Options:    -auto-all
     if flag(cgi)
