Merge branch 'master' of git://factorcode.org/git/littledan
commit
ef3064260c
|
@ -0,0 +1 @@
|
||||||
|
Daniel Ehrenberg
|
|
@ -0,0 +1,12 @@
|
||||||
|
USING: help.syntax help.markup ;
|
||||||
|
IN: io.encodings.iana
|
||||||
|
|
||||||
|
HELP: name>encoding
|
||||||
|
{ $values { "string" "an encoding name" } { "encoding" "an encoding descriptor" } }
|
||||||
|
{ "Given an IANA-registered encoding name, find the encoding descriptor that represents it, or " { $code f } " if it is not found (either not implemented in Factor or not registered)." } ;
|
||||||
|
|
||||||
|
HELP: encoding>name
|
||||||
|
{ $values { "encoding" "an encoding descriptor" } { "name" "an encoding name" } }
|
||||||
|
{ "Given an encoding descriptor, return the preferred IANA name." } ;
|
||||||
|
|
||||||
|
{ name>encoding encoding>name } related-words
|
|
@ -0,0 +1,5 @@
|
||||||
|
USING: io.encodings.iana io.encodings.ascii tools.test ;
|
||||||
|
|
||||||
|
[ ascii ] [ "US-ASCII" name>encoding ] unit-test
|
||||||
|
[ ascii ] [ "ASCII" name>encoding ] unit-test
|
||||||
|
[ "US-ASCII" ] [ ascii encoding>name ] unit-test
|
|
@ -1,8 +1,11 @@
|
||||||
|
! Copyright (C) 2008 Daniel Ehrenberg
|
||||||
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: kernel strings unicode.syntax.backend io.files assocs
|
USING: kernel strings unicode.syntax.backend io.files assocs
|
||||||
splitting sequences io namespaces sets
|
splitting sequences io namespaces sets
|
||||||
io.encodings.ascii io.encodings.utf8 io.encodings.utf16 io.encodings.8-bit ;
|
io.encodings.ascii io.encodings.utf8 io.encodings.utf16 io.encodings.8-bit ;
|
||||||
IN: io.encodings.iana
|
IN: io.encodings.iana
|
||||||
|
|
||||||
|
<PRIVATE
|
||||||
VALUE: n>e-table
|
VALUE: n>e-table
|
||||||
|
|
||||||
: e>n-table H{
|
: e>n-table H{
|
||||||
|
@ -22,6 +25,7 @@ VALUE: n>e-table
|
||||||
{ latin5 "ISO-8859-9" }
|
{ latin5 "ISO-8859-9" }
|
||||||
{ latin6 "ISO-8859-10" }
|
{ latin6 "ISO-8859-10" }
|
||||||
} ;
|
} ;
|
||||||
|
PRIVATE>
|
||||||
|
|
||||||
: name>encoding ( string -- encoding )
|
: name>encoding ( string -- encoding )
|
||||||
n>e-table at ;
|
n>e-table at ;
|
||||||
|
@ -29,6 +33,7 @@ VALUE: n>e-table
|
||||||
: encoding>name ( encoding -- string )
|
: encoding>name ( encoding -- string )
|
||||||
e>n-table at ;
|
e>n-table at ;
|
||||||
|
|
||||||
|
<PRIVATE
|
||||||
: parse-iana ( stream -- synonym-set )
|
: parse-iana ( stream -- synonym-set )
|
||||||
lines { "" } split [
|
lines { "" } split [
|
||||||
[ " " split ] map
|
[ " " split ] map
|
||||||
|
@ -44,6 +49,7 @@ VALUE: n>e-table
|
||||||
[ drop ] if*
|
[ drop ] if*
|
||||||
] with each
|
] with each
|
||||||
] each ] H{ } make-assoc ;
|
] each ] H{ } make-assoc ;
|
||||||
|
PRIVATE>
|
||||||
|
|
||||||
"resource:extra/io/encodings/iana/character-sets"
|
"resource:extra/io/encodings/iana/character-sets"
|
||||||
ascii <file-reader> make-n>e \ n>e-table set-value
|
ascii <file-reader> make-n>e \ n>e-table set-value
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
Tables for IANA encoding names
|
Loading…
Reference in New Issue