diff --git a/library/text/encoder/encoder-safe.ecf b/library/text/encoder/encoder-safe.ecf
index 1b249ddf..bff977f0 100644
--- a/library/text/encoder/encoder-safe.ecf
+++ b/library/text/encoder/encoder-safe.ecf
@@ -15,7 +15,18 @@
/tests$
+ /spec$
+
+
+
+
+
+
+
+
+
+
diff --git a/library/text/encoder/encoder.ecf b/library/text/encoder/encoder.ecf
index de457982..0905930b 100644
--- a/library/text/encoder/encoder.ecf
+++ b/library/text/encoder/encoder.ecf
@@ -15,7 +15,18 @@
/tests$
+ /spec$
+
+
+
+
+
+
+
+
+
+
diff --git a/library/text/encoder/src/spec/70/utf8_url_encoder_i.e b/library/text/encoder/src/spec/70/utf8_url_encoder_i.e
new file mode 100644
index 00000000..024d3db8
--- /dev/null
+++ b/library/text/encoder/src/spec/70/utf8_url_encoder_i.e
@@ -0,0 +1,32 @@
+note
+ description : "Objects that ..."
+ author : "$Author$"
+ date : "$Date$"
+ revision : "$Revision$"
+
+deferred class
+ UTF8_URL_ENCODER_I
+
+inherit
+ ANY
+
+ UNICODE_CONVERSION
+ export
+ {NONE} all
+ {ANY} is_valid_utf8
+ undefine
+ is_little_endian
+ end
+
+
+note
+ copyright: "2011-2011, Eiffel Software and others"
+ license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
+ source: "[
+ Eiffel Software
+ 5949 Hollister Ave., Goleta, CA 93117 USA
+ Telephone 805-685-1006, Fax 805-685-6869
+ Website http://www.eiffel.com
+ Customer support http://support.eiffel.com
+ ]"
+end
diff --git a/library/text/encoder/src/spec/before_70/utf8_url_encoder_i.e b/library/text/encoder/src/spec/before_70/utf8_url_encoder_i.e
new file mode 100644
index 00000000..1b52a706
--- /dev/null
+++ b/library/text/encoder/src/spec/before_70/utf8_url_encoder_i.e
@@ -0,0 +1,73 @@
+note
+ description : "Objects that ..."
+ author : "$Author$"
+ date : "$Date$"
+ revision : "$Revision$"
+
+deferred class
+ UTF8_URL_ENCODER_I
+
+inherit
+ ANY
+
+ UNICODE_CONVERSION
+ export
+ {NONE} all
+ undefine
+ is_little_endian
+ end
+
+feature -- Status report
+
+ is_valid_utf8 (a_string: STRING): BOOLEAN
+ -- Is `a_string' valid UTF-8 string?
+ require
+ a_string_not_void: a_string /= Void
+ local
+ l_nat8: NATURAL_8
+ l_code: NATURAL_32
+ i, nb, cnt: INTEGER
+ do
+ from
+ i := 1
+ nb := a_string.count
+ Result := True
+ until
+ i > nb or not Result
+ loop
+ l_nat8 := a_string.code (i).to_natural_8
+ if l_nat8 <= 127 then
+ -- Form 0xxxxxxx.
+ elseif (l_nat8 & 0xE0) = 0xC0 then
+ -- Form 110xxxxx 10xxxxxx.
+ l_code := (l_nat8 & 0x1F).to_natural_32 |<< 6
+ i := i + 1
+ elseif (l_nat8 & 0xF0) = 0xE0 then
+ -- Form 1110xxxx 10xxxxxx 10xxxxxx.
+ i := i + 2
+ elseif (l_nat8 & 0xF8) = 0xF0 then
+ -- Form 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx.
+ i := i + 3
+ elseif (l_nat8 & 0xFC) = 0xF8 then
+ -- Starts with 111110xx
+ Result := False
+ else
+ -- Starts with 1111110x
+ Result := False
+ end
+ i := i + 1
+ end
+ end
+
+
+note
+ copyright: "2011-2011, Eiffel Software and others"
+ license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
+ source: "[
+ Eiffel Software
+ 5949 Hollister Ave., Goleta, CA 93117 USA
+ Telephone 805-685-1006, Fax 805-685-6869
+ Website http://www.eiffel.com
+ Customer support http://support.eiffel.com
+ ]"
+end
diff --git a/library/text/encoder/src/utf8_url_encoder.e b/library/text/encoder/src/utf8_url_encoder.e
index f1fbffdd..443a527f 100644
--- a/library/text/encoder/src/utf8_url_encoder.e
+++ b/library/text/encoder/src/utf8_url_encoder.e
@@ -21,12 +21,7 @@ inherit
decoded_string
end
- UNICODE_CONVERSION
- export
- {NONE} all
- {ANY} is_valid_utf8
- undefine
- is_little_endian
+ UTF8_URL_ENCODER_I
redefine
default_create
end
@@ -35,7 +30,7 @@ feature {NONE} -- Initialization
default_create
do
- Precursor {UNICODE_CONVERSION}
+ Precursor {UTF8_URL_ENCODER_I}
end
feature -- Access