idna 0.1.2 → 0.2
raw patch · 2 files changed
+13/−11 lines, 2 filesdep +punycodedep −encoding
Dependencies added: punycode
Dependencies removed: encoding
Files
- Text/IDNA.hs +6/−8
- idna.cabal +7/−3
Text/IDNA.hs view
@@ -6,12 +6,10 @@ import Text.StringPrep import Text.NamePrep import Control.Monad-import Data.Encoding.BootString-import Data.Encoding.ByteSink-import Data.Encoding import qualified Data.Text as Text import Data.Text (Text)-import qualified Data.Text.Encoding as E+import qualified Data.Text.Punycode as Puny+import Data.Text.Encoding as E -- | The ASCII Compatible Encoding prefix (currently \'@xn--@\'). acePrefix :: Text@@ -34,9 +32,9 @@ step7 <- if (Text.any (>'\x7f') step2) then if acePrefix `Text.isPrefixOf` step3 then Nothing- else case encodeStrictByteStringExplicit punycode $ Text.unpack step3 of+ else case return (Puny.encode step3) of -- TODO: this can fail? Left _ -> Nothing- Right t -> return $ acePrefix `Text.append` E.decodeASCII t+ Right t -> return $ acePrefix `Text.append` E.decodeUtf8 t else return step3 if Text.length step7 <= 63@@ -66,9 +64,9 @@ else return step2 let step4 = Text.drop (Text.length acePrefix) step3- step5 <- case decodeStrictByteStringExplicit punycode $ E.encodeUtf8 step4 of+ step5 <- case Puny.decode $ E.encodeUtf8 step4 of Left _ -> Left step3- Right s -> return (Text.pack s)+ Right s -> return s case toASCII allowUnassigned useSTD3ASCIIRules step5 of Nothing -> return step3
idna.cabal view
@@ -1,6 +1,6 @@ Name: idna-Version: 0.1.2-Description: Implements IDNA -- Internationalized Domain Names in Applications (RFC 3490).+Version: 0.2+Description: Implements IDNA - Internationalized Domain Names in Applications (RFC 3490). Synopsis: Implements IDNA (RFC 3490). License: BSD3 Author: George Pollard <porges@porg.es>@@ -11,6 +11,10 @@ Category: Data, Text, RFC Library- Build-Depends: base >= 4.3 && < 5, encoding>=0.5.1, stringprep>=0.1.2, text>=0.1+ Build-Depends: base >= 4.3 && < 5, stringprep>=0.1.2, text>=0.1, punycode>=2.0 Exposed-modules: Text.IDNA ghc-options: -O2 -Wall++source-repository head+ type: git+ location: https://github.com/Porges/idna-hs