diff --git a/library/text/encoder/src/html_encoder.e b/library/text/encoder/src/html_encoder.e
index efd76425..9bb0fc08 100644
--- a/library/text/encoder/src/html_encoder.e
+++ b/library/text/encoder/src/html_encoder.e
@@ -13,7 +13,7 @@ class
HTML_ENCODER
inherit
- ENCODER [STRING_32, STRING_8]
+ ENCODER [READABLE_STRING_32, READABLE_STRING_8]
PLATFORM
export
@@ -33,7 +33,7 @@ feature -- Status report
feature -- Encoder
- encoded_string (s: STRING_32): STRING_8
+ encoded_string (s: READABLE_STRING_32): STRING_8
-- HTML-encoded value of `s'.
local
i, n: INTEGER
@@ -67,7 +67,7 @@ feature -- Encoder
feature -- Decoder
- decoded_string (v: STRING_8): STRING_32
+ decoded_string (v: READABLE_STRING_8): STRING_32
-- The HTML-encoded equivalent of the given string
local
i, n: INTEGER
@@ -259,7 +259,7 @@ feature {NONE} -- Implementation: decoder
end
note
- copyright: "2011-2011, Eiffel Software and others"
+ copyright: "2011-2012, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
source: "[
Eiffel Software
diff --git a/library/text/encoder/src/json_encoder.e b/library/text/encoder/src/json_encoder.e
index 94075cbe..333c7e34 100644
--- a/library/text/encoder/src/json_encoder.e
+++ b/library/text/encoder/src/json_encoder.e
@@ -1,7 +1,7 @@
note
description: "[
Summary description for {JSON_ENCODER}.
-
+
]"
legal: "See notice at end of class."
status: "See notice at end of class."
@@ -12,7 +12,7 @@ class
JSON_ENCODER
inherit
- ENCODER [STRING_32, STRING_8]
+ ENCODER [READABLE_STRING_32, READABLE_STRING_8]
PLATFORM
export
@@ -32,7 +32,7 @@ feature -- Status report
feature -- Encoder
- encoded_string (s: STRING_32): STRING_8
+ encoded_string (s: READABLE_STRING_32): STRING_8
-- JSON-encoded value of `s'.
local
i, j, n: INTEGER
@@ -82,7 +82,7 @@ feature -- Encoder
feature -- Decoder
- decoded_string (v: STRING_8): STRING_32
+ decoded_string (v: READABLE_STRING_8): STRING_32
-- The JSON-encoded equivalent of the given string
local
i, n: INTEGER
diff --git a/library/text/encoder/src/url_encoder.e b/library/text/encoder/src/url_encoder.e
index 386b64da..9720150b 100644
--- a/library/text/encoder/src/url_encoder.e
+++ b/library/text/encoder/src/url_encoder.e
@@ -33,17 +33,15 @@ feature -- Status report
feature -- Encoder
- encoded_string (s: READABLE_STRING_32): READABLE_STRING_8
+ encoded_string (s: READABLE_STRING_32): STRING_8
-- URL-encoded value of `s'.
local
i, n: INTEGER
uc: CHARACTER_32
c: CHARACTER_8
- s8: STRING_8
do
has_error := False
- create s8.make (s.count + s.count // 10)
- Result := s8
+ create Result.make (s.count + s.count // 10)
n := s.count
from i := 1 until i > n loop
uc := s.item (i)
@@ -55,14 +53,14 @@ feature -- Encoder
'a' .. 'z', '0' .. '9',
'.', '-', '~', '_'
then
- s8.extend (c)
+ Result.extend (c)
when ' ' then
- s8.extend ('+')
+ Result.extend ('+')
else
- s8.append (url_encoded_char (uc))
+ Result.append (url_encoded_char (uc))
end
else
- s8.append (url_encoded_char (uc))
+ Result.append (url_encoded_char (uc))
end
i := i + 1
end
@@ -134,19 +132,17 @@ feature {NONE} -- encoder character
feature -- Decoder
- decoded_string (v: READABLE_STRING_8): READABLE_STRING_32
+ decoded_string (v: READABLE_STRING_8): STRING_32
-- The URL-encoded equivalent of the given string
local
i, n: INTEGER
c: CHARACTER
pr: CELL [INTEGER]
- s32: STRING_32
changed: BOOLEAN
do
has_error := False
n := v.count
- create s32.make (n)
- Result := s32
+ create Result.make (n)
from i := 1
until i > n
loop
@@ -154,19 +150,19 @@ feature -- Decoder
inspect c
when '+' then
changed := True
- s32.append_character ({CHARACTER_32}' ')
+ Result.append_character ({CHARACTER_32}' ')
when '%%' then
-- An escaped character ?
if i = n then
- s32.append_character (c.to_character_32)
+ Result.append_character (c.to_character_32)
else
changed := True
create pr.put (i)
- s32.append (url_decoded_char (v, pr))
+ Result.append (url_decoded_char (v, pr))
i := pr.item
end
else
- s32.append_character (c.to_character_32)
+ Result.append_character (c.to_character_32)
end
i := i + 1
end
@@ -367,7 +363,7 @@ feature {NONE} -- Hexadecimal and strings
end
note
- copyright: "2011-2011, Eiffel Software and others"
+ copyright: "2011-2012, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
source: "[
Eiffel Software
diff --git a/library/text/encoder/src/utf8_encoder.e b/library/text/encoder/src/utf8_encoder.e
index 451cb5e3..778ee000 100644
--- a/library/text/encoder/src/utf8_encoder.e
+++ b/library/text/encoder/src/utf8_encoder.e
@@ -13,7 +13,7 @@ class
UTF8_ENCODER
inherit
- ENCODER [STRING_32, STRING_8]
+ ENCODER [READABLE_STRING_32, READABLE_STRING_8]
UTF8_ENCODER_HELPER
@@ -35,7 +35,7 @@ feature -- Status report
feature -- Encoder
- encoded_string (s: STRING_32): STRING_8
+ encoded_string (s: READABLE_STRING_32): STRING_8
-- UTF8-encoded value of `s'.
do
Result := utf32_to_utf8 (s)
@@ -44,7 +44,7 @@ feature -- Encoder
feature -- Decoder
- decoded_string (v: STRING_8): STRING_32
+ decoded_string (v: READABLE_STRING_8): STRING_32
-- The UTF8-encoded equivalent of the given string
do
Result := utf8_to_utf32 (v)
@@ -52,7 +52,7 @@ feature -- Decoder
end
note
- copyright: "2011-2011, Eiffel Software and others"
+ copyright: "2011-2012, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
source: "[
Eiffel Software
diff --git a/library/text/encoder/src/utf8_url_encoder.e b/library/text/encoder/src/utf8_url_encoder.e
index 3648f111..8fca01d2 100644
--- a/library/text/encoder/src/utf8_url_encoder.e
+++ b/library/text/encoder/src/utf8_url_encoder.e
@@ -42,7 +42,7 @@ feature -- Access
feature -- Encoder
- encoded_string (s: READABLE_STRING_32): READABLE_STRING_8
+ encoded_string (s: READABLE_STRING_32): STRING_8
-- URL-encoded value of `s'.
do
Result := Precursor (s)
@@ -64,7 +64,7 @@ feature -- Encoder
feature -- Decoder
- decoded_string (v: READABLE_STRING_8): READABLE_STRING_32
+ decoded_string (v: READABLE_STRING_8): STRING_32
-- The URL-encoded equivalent of the given string
do
Result := Precursor (v)
@@ -77,7 +77,7 @@ feature -- Decoder
end
note
- copyright: "2011-2011, Eiffel Software and others"
+ copyright: "2011-2012, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
source: "[
Eiffel Software
diff --git a/library/text/encoder/src/xml_encoder.e b/library/text/encoder/src/xml_encoder.e
index 4fd33f94..8c8fd7a9 100644
--- a/library/text/encoder/src/xml_encoder.e
+++ b/library/text/encoder/src/xml_encoder.e
@@ -13,7 +13,7 @@ class
XML_ENCODER
inherit
- ENCODER [STRING_32, STRING_8]
+ ENCODER [READABLE_STRING_32, READABLE_STRING_8]
PLATFORM
export
@@ -33,7 +33,7 @@ feature -- Status report
feature -- Encoder
- encoded_string (s: STRING_32): STRING_8
+ encoded_string (s: READABLE_STRING_32): STRING_8
-- XML-encoded value of `s'.
local
i, n: INTEGER
@@ -67,7 +67,7 @@ feature -- Encoder
feature -- Decoder
- decoded_string (v: STRING_8): STRING_32
+ decoded_string (v: READABLE_STRING_8): STRING_32
-- The XML-encoded equivalent of the given string
local
i, n: INTEGER
@@ -259,7 +259,7 @@ feature {NONE} -- Implementation: decoder
end
note
- copyright: "2011-2011, Eiffel Software and others"
+ copyright: "2011-2012, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
source: "[
Eiffel Software
diff --git a/library/text/encoder/tests/test_url_encoder.e b/library/text/encoder/tests/test_url_encoder.e
index e55fe18f..25cff7b7 100644
--- a/library/text/encoder/tests/test_url_encoder.e
+++ b/library/text/encoder/tests/test_url_encoder.e
@@ -19,10 +19,11 @@ feature -- Test routines
note
testing: "url-encoded"
do
- test_url_encoded_encoding ("http://domain.tld/foo/bar/script.php?test='toto'&foo=bar&title=il était une fois")
- test_url_encoded_encoding ("été")
- test_url_encoded_decoding ("%%E9t%%E9", "été")
- test_url_encoded_decoding ("%%C3%%A9t%%C3%%A9", "été")
+ test_url_encoded_encoding ({STRING_32}"http://domain.tld/foo/bar/script.php?test='toto'&foo=bar&title=il était une fois")
+ test_url_encoded_encoding ({STRING_32}"été")
+ test_url_encoded_decoding ({STRING_8}"%%E9t%%E9", {STRING_32}"été")
+
+ test_utf8_url_encoded_decoding ({STRING_8}"%%C3%%A9t%%C3%%A9", {STRING_32}"été")
end
test_url_encoded_encoding (s: STRING_32)
@@ -47,6 +48,16 @@ feature -- Test routines
assert ("decoded encoded string is same for %"" + s + "%"", u ~ e)
end
+ test_utf8_url_encoded_decoding (s: STRING_8; e: STRING_32)
+ local
+ u: STRING_32
+ b: UTF8_URL_ENCODER
+ do
+ create b
+ u := b.decoded_string (s)
+ assert ("decoded encoded string is same for %"" + s + "%"", u ~ e)
+ end
+
note
copyright: "2011-2011, Eiffel Software and others"
diff --git a/library/text/encoder/tests/test_utf8_encoder.e b/library/text/encoder/tests/test_utf8_encoder.e
index f87bdac1..e1f29c61 100644
--- a/library/text/encoder/tests/test_utf8_encoder.e
+++ b/library/text/encoder/tests/test_utf8_encoder.e
@@ -19,8 +19,7 @@ feature -- Test routines
note
testing: "url-encoded"
do
--- test_utf8_decoding ("summer=été&weird=ŕ", "summer=été&weird=ŕ")
- test_utf8_decoding ("%%C3%%A9t%%C3%%A9", "été")
+ test_utf8_decoding ("%%C3%%A9t%%C3%%A9", {STRING_32}"été")
end
test_utf8_decoding (s: STRING_8; e: STRING_32)
diff --git a/library/text/encoder/tests/tests-safe.ecf b/library/text/encoder/tests/tests-safe.ecf
new file mode 100644
index 00000000..be446169
--- /dev/null
+++ b/library/text/encoder/tests/tests-safe.ecf
@@ -0,0 +1,18 @@
+
+
+
+
+
+ /.git$
+ /EIFGENs$
+ /.svn$
+
+
+
+
+
+
+
+