diff --git a/LICENSE b/LICENSE
new file mode 100644
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,31 @@
+Copyright Péter Diviánszky 2008
+
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+    * Redistributions of source code must retain the above copyright
+      notice, this list of conditions and the following disclaimer.
+
+    * Redistributions in binary form must reproduce the above
+      copyright notice, this list of conditions and the following
+      disclaimer in the documentation and/or other materials provided
+      with the distribution.
+
+    * Neither the name of Péter Diviánszky nor the names of other
+      contributors may be used to endorse or promote products derived
+      from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
diff --git a/Setup.hs b/Setup.hs
new file mode 100644
--- /dev/null
+++ b/Setup.hs
@@ -0,0 +1,5 @@
+
+import Distribution.Simple
+
+main = defaultMainWithHooks defaultUserHooks
+
diff --git a/System/UTF8IO.hs b/System/UTF8IO.hs
new file mode 100644
--- /dev/null
+++ b/System/UTF8IO.hs
@@ -0,0 +1,59 @@
+-----------------------------------------------------------------------------
+-- |
+-- Module      :  System.UTF8IO
+-- Copyright   :  (c) Péter Diviánszky 2008
+-- License     :  BSD3-style (see LICENSE)
+-- 
+-- Maintainer:    divip@aszt.inf.elte.hu
+-- Stability   :  alpha
+-- Portability :  portable
+--
+-- This module defines the same entities as "System.IO" but uses UTF8 encoding.
+--
+-- Usage:
+--
+-- > import System.UTF8IO
+--
+-- And you probably want to declare:
+--
+-- > import qualified Prelude
+-- > import UTF8Prelude
+--
+-- This module is based on "System.IO.UTF8".
+
+module System.UTF8IO
+    ( module System.IO
+    , module System.IO.UTF8
+    ) where
+
+import System.IO.UTF8 hiding
+    ( print
+    , putStr
+    , putStrLn
+    , getLine
+    , readLn
+    , readFile
+    , writeFile
+    , appendFile
+    , getContents
+    )
+
+import System.IO hiding 
+    ( print
+    , putStr
+    , putStrLn
+    , getLine
+    , readLn
+    , readFile
+    , writeFile
+    , appendFile
+    , getContents
+    , hGetLine
+    , hGetContents
+    , hPutStr
+    , hPutStrLn
+    )
+
+
+
+
diff --git a/Test.hs b/Test.hs
new file mode 100644
--- /dev/null
+++ b/Test.hs
@@ -0,0 +1,53 @@
+
+import Paths_utf8_prelude
+
+import Data.Maybe
+
+import qualified Prelude
+import UTF8Prelude
+
+----------------------
+
+writeFile_test :: String
+writeFile_test = "writeFile_test.txt"
+
+main :: IO ()
+main = do
+    do
+        s <- do
+            readFile_test <- getDataFileName "readFile_test.txt"
+            s <- readFile readFile_test 
+            let errors = catMaybes $ map checkLine $ lines s
+            assert (null errors) "readFile" $ head errors
+            return s
+
+        do
+            writeFile writeFile_test s
+            s' <- readFile writeFile_test 
+            let diffs = filter (\(a,b) -> a /= b) $ zip s s'
+            assert (null diffs) "writeFile" $ "First 10 different charcodes: " ++ show (take 10 diffs)
+
+    do
+        putStrLn "Basic putStrLn test:"
+        putStrLn_test <- getDataFileName "putStrLn_test.txt"
+        s <- readFile putStrLn_test
+        mapM_ putStrLn $ map ("  " ++) $ lines s
+
+
+checkLine :: String -> Maybe String
+checkLine s = case reads s of
+    [(i, [' ',c])]
+        | i == fromEnum c -> Nothing
+    [(i, ' ':cs)]
+        | otherwise -> Just $ "\"\\" ++ show i ++ "\" /= \"" ++ cs ++ "\""
+    _  -> Just $ "Fatal error: Invalid line in testfile: " ++ s
+
+assert :: Bool -> String -> String -> IO ()
+assert True t _ = putStrLn $ t ++ " test OK."
+assert False t s = error $ t ++ " test failed! " ++ s
+
+make_readFile_test :: IO ()
+make_readFile_test = writeFile "readFile_test.txt" $ unlines [show i ++ " " ++ [toEnum i] | i<-[33,132..55000]]
+-- it fails with [33,132..65535]!
+
+
diff --git a/UTF8Prelude.hs b/UTF8Prelude.hs
new file mode 100644
--- /dev/null
+++ b/UTF8Prelude.hs
@@ -0,0 +1,63 @@
+-----------------------------------------------------------------------------
+-- |
+-- Module      :  UTF8Prelude
+-- Copyright   :  (c) Péter Diviánszky 2008
+-- License     :  BSD3-style (see LICENSE)
+-- 
+-- Maintainer:    divip@aszt.inf.elte.hu
+-- Stability   :  alpha
+-- Portability :  portable
+--
+-- This module defines the same entities as "Prelude" but uses UTF8 encoding.
+--
+-- Usage:
+--
+-- > import qualified Prelude
+-- > import UTF8Prelude
+--
+-- This module is based on "System.IO.UTF8".
+
+module UTF8Prelude 
+    ( module Prelude
+--    , module System.IO.UTF8
+    , error
+    , print
+    , putStr
+    , putStrLn
+    , getLine
+    , readLn
+    , readFile
+    , writeFile
+    , appendFile
+    , getContents
+    ) where
+
+import Codec.Binary.UTF8.String (encodeString)
+
+import System.IO.UTF8 hiding
+    ( hGetLine
+    , hGetContents
+    , hPutStr
+    , hPutStrLn
+    )
+
+import Prelude hiding 
+    ( error
+    , print
+    , putStr
+    , putStrLn
+    , getLine
+    , readLn
+    , readFile
+    , writeFile
+    , appendFile
+    , getContents
+    )
+
+import qualified Prelude
+
+-- | UTF8 encoded error messages
+error :: String -> a
+error = Prelude.error . encodeString
+
+
diff --git a/putStrLn_test.txt b/putStrLn_test.txt
new file mode 100644
--- /dev/null
+++ b/putStrLn_test.txt
@@ -0,0 +1,17 @@
+
+Language            Non-ASCII Characters
+------------------- ----------------------------------------------------------  
+Danish (da)         åæø ÅÆØ
+German (de)         üßäö ÜÄÖ
+Greek (el)          γξάέίαβδεζθικλμνοπρςστυφχψωόὰὲὴὶὸῶ ΓΞΆΈΊΑΒΔΕΖΘΙΚΛΜΝΟΠΡΣΤΥΦΧΨΩΌᾺῈῊῚῸ
+Spanish (es)        íñóü ÍÑÓÜ
+French (fr)         âôàäæçèéêëîïöùûüÿœ ÂÔÀÄÆÇÈÉÊËÎÏÖÙÛÜŸŒ
+Irish Gaelic (ga)   áéíóú ÁÉÍÓÚ
+Hungarian (hu)      áéíóöőúüű ÁÉÍÓÖŐÚÜŰ
+Icelandic (is)      áæéíðóöúýþ ÁÆÉÍÐÓÖÚÝÞ
+Hebrew (iw)         אבגדהוזחטיךכלםמןסעפצקרשת
+Japanese (jp)       あいうえおかきくけこさしすせそたちつてとなにぬねのはひふへほまみむめもやゆよらりるれろわゐゑをアイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワヰヱヲン
+Polish (pl)         óąćęłńśźż ÓĄĆĘŁŃŚŹŻ
+Russian (ru)        вдабгежзийклмнопрстуфхцчшщыьэюя ВДАБГЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЫЬЭЮЯ
+Thai (th)           กขคฆงจฉชซฌญฎฏฐฑฒณดตถทธนบปผฝพฟภมยรฤลวศษสหฬอฮฯะัาำิีึืุูเแโใไๅๆ็่้๊๋์๏
+
diff --git a/readFile_test.txt b/readFile_test.txt
new file mode 100644
--- /dev/null
+++ b/readFile_test.txt
@@ -0,0 +1,556 @@
+32  
+131 
+230 æ
+329 ŉ
+428 Ƭ
+527 ȏ
+626 ɲ
+725 ˕
+824 ̸
+923 Λ
+1022 Ͼ
+1121 ѡ
+1220 ӄ
+1319 ԧ
+1418 ֊
+1517 ׭
+1616 ِ
+1715 ڳ
+1814 ܖ
+1913 ݹ
+2012 ߜ
+2111 ࠿
+2210 ࢢ
+2309 अ
+2408 २
+2507 ো
+2606 ਮ
+2705 ઑ
+2804 ૴
+2903 ୗ
+3002 ஺
+3101 ఝ
+3200 ಀ
+3299 ೣ
+3398 െ
+3497 ඩ
+3596 ฌ
+3695 ๯
+3794 ໒
+3893 ༵
+3992 ྘
+4091 ࿻
+4190 ၞ
+4289 Ⴡ
+4388 ᄤ
+4487 ᆇ
+4586 ᇪ
+4685 ቍ
+4784 ኰ
+4883 ጓ
+4982 ፶
+5081 Ꮩ
+5180 ᐼ
+5279 ᒟ
+5378 ᔂ
+5477 ᕥ
+5576 ᗈ
+5675 ᘫ
+5774 ᚎ
+5873 ᛱ
+5972 ᝔
+6071 ិ
+6170 ᠚
+6269 ᡽
+6368 ᣠ
+6467 ᥃
+6566 ᦦ
+6665 ᨉ
+6764 ᩬ
+6863 ᫏
+6962 ᬲ
+7061 ᮕ
+7160 ᯸
+7259 ᱛ
+7358 Ჾ
+7457 ᴡ
+7556 ᶄ
+7655 ᷧ
+7754 Ṋ
+7853 ậ
+7952 ἐ
+8051 έ
+8150 ῖ
+8249 ‹
+8348 ₜ
+8447 ⃿
+8546 Ⅲ
+8645 ⇅
+8744 ∨
+8843 ⊋
+8942 ⋮
+9041 ⍑
+9140 ⎴
+9239 ␗
+9338 ⑺
+9437 ⓝ
+9536 ╀
+9635 ▣
+9734 ☆
+9833 ♩
+9932 ⛌
+10031 ✯
+10130 ➒
+10229 ⟵
+10328 ⡘
+10427 ⢻
+10526 ⤞
+10625 ⦁
+10724 ⧤
+10823 ⩇
+10922 ⪪
+11021 ⬍
+11120 ⭰
+11219 ⯓
+11318 ⰶ
+11417 ⲙ
+11516 ⳼
+11615 ⵟ
+11714 ⷂ
+11813 ⸥
+11912 ⺈
+12011 ⻫
+12110 ⽎
+12209 ⾱
+12308 〔
+12407 ぷ
+12506 ペ
+12605 ㄽ
+12704 ㆠ
+12803 ㈃
+12902 ㉦
+13001 ㋉
+13100 ㌬
+13199 ㎏
+13298 ㏲
+13397 㑕
+13496 㒸
+13595 㔛
+13694 㕾
+13793 㗡
+13892 㙄
+13991 㚧
+14090 㜊
+14189 㝭
+14288 㟐
+14387 㠳
+14486 㢖
+14585 㣹
+14684 㥜
+14783 㦿
+14882 㨢
+14981 㪅
+15080 㫨
+15179 㭋
+15278 㮮
+15377 㰑
+15476 㱴
+15575 㳗
+15674 㴺
+15773 㶝
+15872 㸀
+15971 㹣
+16070 㻆
+16169 㼩
+16268 㾌
+16367 㿯
+16466 䁒
+16565 䂵
+16664 䄘
+16763 䅻
+16862 䇞
+16961 䉁
+17060 䊤
+17159 䌇
+17258 䍪
+17357 䏍
+17456 䐰
+17555 䒓
+17654 䓶
+17753 䕙
+17852 䖼
+17951 䘟
+18050 䚂
+18149 䛥
+18248 䝈
+18347 䞫
+18446 䠎
+18545 䡱
+18644 䣔
+18743 䤷
+18842 䦚
+18941 䧽
+19040 䩠
+19139 䫃
+19238 䬦
+19337 䮉
+19436 䯬
+19535 䱏
+19634 䲲
+19733 䴕
+19832 䵸
+19931 ䷛
+20030 举
+20129 亡
+20228 伄
+20327 佧
+20426 俊
+20525 倭
+20624 傐
+20723 僳
+20822 兖
+20921 冹
+21020 刜
+21119 剿
+21218 勢
+21317 卅
+21416 厨
+21515 吋
+21614 呮
+21713 哑
+21812 唴
+21911 喗
+22010 嗺
+22109 噝
+22208 囀
+22307 圣
+22406 垆
+22505 埩
+22604 塌
+22703 墯
+22802 夒
+22901 奵
+23000 姘
+23099 娻
+23198 媞
+23297 嬁
+23396 孤
+23495 寇
+23594 尪
+23693 岍
+23792 峰
+23891 嵓
+23990 嶶
+24089 帙
+24188 幼
+24287 廟
+24386 彂
+24485 徥
+24584 怈
+24683 恫
+24782 惎
+24881 愱
+24980 憔
+25079 懷
+25178 扚
+25277 抽
+25376 挠
+25475 掃
+25574 揦
+25673 摉
+25772 撬
+25871 攏
+25970 敲
+26069 旕
+26168 昸
+26267 暛
+26366 曾
+26465 条
+26564 柄
+26663 栧
+26762 梊
+26861 棭
+26960 楐
+27059 榳
+27158 樖
+27257 橹
+27356 櫜
+27455 欿
+27554 殢
+27653 氅
+27752 汨
+27851 泋
+27950 洮
+28049 涑
+28148 淴
+28247 湗
+28346 溺
+28445 漝
+28544 澀
+28643 濣
+28742 灆
+28841 炩
+28940 焌
+29039 煯
+29138 燒
+29237 爵
+29336 犘
+29435 狻
+29534 獞
+29633 珁
+29732 琤
+29831 璇
+29930 瓪
+30029 畍
+30128 疰
+30227 瘓
+30326 癶
+30425 盙
+30524 眼
+30623 瞟
+30722 砂
+30821 硥
+30920 磈
+31019 礫
+31118 禎
+31217 秱
+31316 穔
+31415 窷
+31514 笚
+31613 筽
+31712 篠
+31811 籃
+31910 粦
+32009 紉
+32108 絬
+32207 総
+32306 縲
+32405 纕
+32504 绸
+32603 罛
+32702 羾
+32801 耡
+32900 肄
+32999 胧
+33098 腊
+33197 膭
+33296 舐
+33395 艳
+33494 苖
+33593 茹
+33692 莜
+33791 菿
+33890 葢
+33989 蓅
+34088 蔨
+34187 薋
+34286 藮
+34385 虑
+34484 蚴
+34583 蜗
+34682 蝺
+34781 蟝
+34880 血
+34979 袣
+35078 褆
+35177 襩
+35276 觌
+35375 訯
+35474 誒
+35573 諵
+35672 識
+35771 讻
+35870 谞
+35969 貁
+36068 賤
+36167 赇
+36266 趪
+36365 踍
+36464 蹰
+36563 軓
+36662 輶
+36761 辙
+36860 迼
+36959 遟
+37058 郂
+37157 鄥
+37256 醈
+37355 釫
+37454 鉎
+37553 銱
+37652 錔
+37751 鍷
+37850 鏚
+37949 鐽
+38048 钠
+38147 锃
+38246 镦
+38345 闉
+38444 阬
+38543 随
+38642 雲
+38741 靕
+38840 鞸
+38939 頛
+39038 顾
+39137 飡
+39236 饄
+39335 馧
+39434 騊
+39533 驭
+39632 髐
+39731 鬳
+39830 鮖
+39929 鯹
+40028 鱜
+40127 鲿
+40226 鴢
+40325 鶅
+40424 鷨
+40523 鹋
+40622 麮
+40721 鼑
+40820 齴
+40919 鿗
+41018 ꀺ
+41117 ꂝ
+41216 ꄀ
+41315 ꅣ
+41414 ꇆ
+41513 ꈩ
+41612 ꊌ
+41711 ꋯ
+41810 ꍒ
+41909 ꎵ
+42008 ꐘ
+42107 ꑻ
+42206 ꓞ
+42305 ꕁ
+42404 ꖤ
+42503 ꘇ
+42602 Ꙫ
+42701 ꛍ
+42800 ꜰ
+42899 ꞓ
+42998 ꟶ
+43097 ꡙ
+43196 ꢼ
+43295 ꤟ
+43394 ꦂ
+43493 ꧥ
+43592 ꩈ
+43691 ꪫ
+43790 ꬎ
+43889 ꭱ
+43988 ꯔ
+44087 갷
+44186 겚
+44285 곽
+44384 굠
+44483 귃
+44582 긦
+44681 꺉
+44780 껬
+44879 꽏
+44978 꾲
+45077 뀕
+45176 끸
+45275 냛
+45374 넾
+45473 놡
+45572 누
+45671 뉧
+45770 닊
+45869 댭
+45968 뎐
+46067 돳
+46166 둖
+46265 뒹
+46364 딜
+46463 땿
+46562 뗢
+46661 뙅
+46760 뚨
+46859 뜋
+46958 띮
+47057 럑
+47156 렴
+47255 뢗
+47354 룺
+47453 륝
+47552 맀
+47651 먣
+47750 몆
+47849 뫩
+47948 뭌
+48047 뮯
+48146 밒
+48245 뱵
+48344 볘
+48443 봻
+48542 붞
+48641 븁
+48740 빤
+48839 뻇
+48938 뼪
+49037 뾍
+49136 뿰
+49235 쁓
+49334 삶
+49433 섙
+49532 셼
+49631 쇟
+49730 쉂
+49829 슥
+49928 쌈
+50027 썫
+50126 쏎
+50225 쐱
+50324 쒔
+50423 쓷
+50522 앚
+50621 얽
+50720 옠
+50819 욃
+50918 웦
+51017 읉
+51116 재
+51215 젏
+51314 졲
+51413 죕
+51512 줸
+51611 즛
+51710 짾
+51809 쩡
+51908 쫄
+52007 쬧
+52106 쮊
+52205 쯭
+52304 챐
+52403 첳
+52502 촖
+52601 쵹
+52700 췜
+52799 츿
+52898 캢
+52997 켅
+53096 콨
+53195 쿋
+53294 퀮
+53393 킑
+53492 탴
+53591 텗
+53690 톺
+53789 툝
+53888 튀
+53987 틣
+54086 퍆
+54185 펩
+54284 퐌
+54383 푯
+54482 퓒
+54581 픵
+54680 햘
+54779 헻
+54878 홞
+54977 훁
diff --git a/utf8-prelude.cabal b/utf8-prelude.cabal
new file mode 100644
--- /dev/null
+++ b/utf8-prelude.cabal
@@ -0,0 +1,41 @@
+name:           utf8-prelude
+version:        0.1
+synopsis:       Prelude and System.IO using UTF8 encoding
+description:    
+    This package contains the "UTF8Prelude" and "System.UTF8IO" library modules and the 'utf8-test' executable.
+    .
+    The 'utf8-test' executable tests some functions (@readFile@, @writeFile@, @putStrLn@).
+    .
+    Note: 'utf8-test' creates a file named 'writeFile_test.txt' in the current working directory.
+    .
+    This package is based on the 'utf8-string' package: <http://hackage.haskell.org/cgi-bin/hackage-scripts/package/utf8-string>. 
+    .
+    This package will be obsolate with GHC if GHC will have porper unicode support for text I/O 
+    (planned beyond GHC 6.10, see <http://hackage.haskell.org/trac/ghc/wiki/Status/Releases>).
+category:       System
+author:         Péter Diviánszky <divip@aszt.inf.elte.hu>
+maintainer:     Péter Diviánszky <divip@aszt.inf.elte.hu>
+copyright:      (c) 2008 by Péter Diviánszky
+license:        BSD3
+license-file:   LICENSE
+stability:      alpha
+tested-with:    GHC == 6.8.2
+build-type:     Simple
+cabal-version:  >=1.2
+data-files:     readFile_test.txt,
+                putStrLn_test.txt
+
+library
+    ghc-options:    -Wall
+    build-depends:
+        base,
+        utf8-string
+
+    exposed-modules:
+        UTF8Prelude,
+        System.UTF8IO
+
+executable utf8-test
+    ghc-options:    -Wall
+    main-is:        Test.hs
+
