Addressed various unicode related issues.

Note this is using recent changes from text_filter library.
This commit is contained in:
2015-10-20 18:49:40 +02:00
parent 3f4e70b98c
commit a84f86d7a2
11 changed files with 58 additions and 26 deletions

View File

@@ -9,17 +9,20 @@ class
inherit
CMS_STORAGE_SQL
redefine
sql_read_date_time, sql_read_integer_32
sql_read_date_time, sql_read_integer_32,
sql_read_string_32
end
CMS_CORE_STORAGE_SQL_I
redefine
sql_read_date_time, sql_read_integer_32
sql_read_date_time, sql_read_integer_32,
sql_read_string_32
end
CMS_USER_STORAGE_SQL_I
redefine
sql_read_date_time, sql_read_integer_32
sql_read_date_time, sql_read_integer_32,
sql_read_string_32
end
SQLITE_BIND_ARG_MARSHALLER
@@ -227,6 +230,7 @@ feature -- Operation
local
k: READABLE_STRING_GENERAL
k8: STRING
utf: UTF_CONVERTER
do
create Result.make (a_params.count)
across
@@ -236,11 +240,12 @@ feature -- Operation
if k.is_valid_as_string_8 then
k8 := k.as_string_8
else
k8 := (create {UTF_CONVERTER}).utf_32_string_to_utf_8_string_8 (k)
k8 := utf.utf_32_string_to_utf_8_string_8 (k)
end
if attached {DATE_TIME} ic.item as dt then
Result.force (new_binding_argument (date_time_to_string (dt), ":" + k8))
elseif attached {READABLE_STRING_32} ic.item as s32 then
Result.force (new_binding_argument (utf.utf_32_string_to_utf_8_string_8 (s32), ":" + k8))
else
Result.force (new_binding_argument (ic.item, ":" + k8))
end
@@ -363,6 +368,19 @@ feature -- Access
end
end
sql_read_string_32 (a_index: INTEGER): detachable STRING_32
-- <Precursor>
local
utf: UTF_CONVERTER
do
Result := Precursor (a_index)
if Result = Void then
if attached sql_read_string (a_index) as s8 then
Result := utf.utf_8_string_8_to_string_32 (s8)
end
end
end
sql_read_integer_32 (a_index: INTEGER): INTEGER_32
-- Retrieved value at `a_index' position in `item'.
local

View File

@@ -93,7 +93,7 @@ feature -- HTTP Methods
s.append ("<a href=%"")
s.append (req.absolute_script_url ("/admin/role/" + u.id.out))
s.append ("%">")
s.append (u.name)
s.append (html_encoded (u.name))
s.append ("</a>")
s.append ("</li>%N")
end

View File

@@ -106,7 +106,7 @@ feature -- HTTP Methods
s.append ("<a href=%"")
s.append (req.absolute_script_url ("/admin/user/"+u.id.out))
s.append ("%">")
s.append (u.name)
s.append (html_encoded (u.name))
s.append ("</a>")
s.append ("</li>%N")
end

View File

@@ -50,10 +50,10 @@ feature -- Access
feature -- Access: node
summary: detachable READABLE_STRING_8
summary: detachable READABLE_STRING_32
-- A short summary of the node.
content: detachable READABLE_STRING_8
content: detachable READABLE_STRING_32
-- Content of the node.
format: detachable READABLE_STRING_8

View File

@@ -123,7 +123,7 @@ feature -- HTML Output
do
a_output.append ("<h2>Posts from ")
if attached user as l_user then
a_output.append (l_user.name)
a_output.append (html_encoded (l_user.name))
else
a_output.append ("unknown user")
end

View File

@@ -103,12 +103,12 @@ feature -- Access
-- Full title of the node.
-- Required!
summary: detachable READABLE_STRING_8
summary: detachable READABLE_STRING_32
-- A short summary of the node.
deferred
end
content: detachable READABLE_STRING_8
content: detachable READABLE_STRING_32
-- Content of the node.
deferred
end

View File

@@ -33,10 +33,10 @@ feature -- Access: code
feature -- Access: content
summary: detachable READABLE_STRING_8
summary: detachable READABLE_STRING_32
-- A short summary of the node.
content: detachable READABLE_STRING_8
content: detachable READABLE_STRING_32
-- Content of the node.
format: detachable READABLE_STRING_8

View File

@@ -44,10 +44,10 @@ feature -- Access
feature -- Access: content
summary: detachable READABLE_STRING_8
summary: detachable READABLE_STRING_32
-- A short summary of the node.
content: detachable READABLE_STRING_8
content: detachable READABLE_STRING_32
-- Content of the node.
format: detachable READABLE_STRING_8

View File

@@ -100,6 +100,7 @@ feature -- Forms ...
local
ti: WSF_FORM_TEXT_INPUT
l_uri: detachable READABLE_STRING_8
l_iri: detachable READABLE_STRING_32
do
-- Path alias
create ti.make ("path_alias")
@@ -111,7 +112,8 @@ feature -- Forms ...
if attached a_node.link as lnk then
l_uri := lnk.location
else
l_uri := percent_encoder.percent_decoded_string (response.api.location_alias (response.node_api.node_path (a_node)))
l_iri := percent_encoder.percent_decoded_string (response.api.location_alias (response.node_api.node_path (a_node)))
l_uri := l_iri.to_string_8
end
ti.set_text_value (l_uri)
ti.set_description ("Optionally specify an alternative URL path by which this content can be accessed. For example, type 'about' when writing an about page. Use a relative path or the URL alias won't work.")
@@ -151,10 +153,9 @@ feature -- Forms ...
end
end
update_node (response: NODE_RESPONSE; fd: WSF_FORM_DATA; a_node: CMS_NODE)
local
b,s: detachable READABLE_STRING_8
b,s: detachable READABLE_STRING_32
f: detachable CONTENT_FORMAT
do
if attached fd.integer_item ("id") as l_id and then l_id > 0 then
@@ -193,7 +194,7 @@ feature -- Forms ...
new_node (response: NODE_RESPONSE; fd: WSF_FORM_DATA; a_node: detachable CMS_NODE): G
-- <Precursor>
local
b,s: detachable READABLE_STRING_8
b,s: detachable READABLE_STRING_32
f: detachable CONTENT_FORMAT
l_node: detachable like new_node
do
@@ -304,7 +305,7 @@ feature -- Output
s.append ("<div class=%"info%"> ")
if attached a_node.author as l_author then
s.append (" by ")
s.append (l_author.name)
s.append (a_response.html_encoded (l_author.name))
end
if attached a_node.modification_date as l_modified then
s.append (" (modified: ")
@@ -321,9 +322,9 @@ feature -- Output
-- if attached a_node.summary as l_summary then
-- s.append ("<p class=%"summary%">")
-- if attached node_api.cms_api.format (a_node.format) as f then
-- s.append (f.formatted_output (l_summary))
-- append_formatted_output (l_content, f, s)
-- else
-- s.append (a_response.formats.default_format.formatted_output (l_summary))
-- append_formatted_output (l_content, a_response.formats.default_format, s)
-- end
-- s.append ("</p>")
@@ -333,9 +334,9 @@ feature -- Output
if attached a_node.content as l_content then
s.append ("<p class=%"content%">")
if attached node_api.cms_api.format (a_node.format) as f then
s.append (f.formatted_output (l_content))
append_formatted_output (l_content, f, s)
else
s.append (a_response.formats.default_format.formatted_output (l_content))
append_formatted_output (l_content, a_response.formats.default_format, s)
end
s.append ("</p>")
@@ -346,5 +347,15 @@ feature -- Output
a_response.set_main_content (s)
end
append_formatted_output (a_content: READABLE_STRING_GENERAL; a_format: CONTENT_FORMAT; a_output: STRING_8)
-- Format `a_content' with format `a_format'.
do
if a_content.is_valid_as_string_8 then
a_output.append (a_format.formatted_output (a_content.to_string_8))
else
a_format.append_formatted_to (a_content, a_output)
end
end
end

View File

@@ -575,7 +575,7 @@ feature {NONE} -- Implementation
if attached sql_read_string_32 (5) as l_summary then
Result.set_summary (l_summary)
end
if attached sql_read_string (6) as l_content then
if attached sql_read_string_32 (6) as l_content then
Result.set_content (l_content)
end
if attached sql_read_string (7) as l_format then

View File

@@ -315,11 +315,14 @@ feature -- Access
-- Retrieved value at `a_index' position in `item'.
local
l_item: like sql_item
utf: UTF_CONVERTER
do
-- FIXME: handle string_32 !
l_item := sql_item (a_index)
if attached {READABLE_STRING_32} l_item as l_string then
Result := l_string
elseif attached {READABLE_STRING_8} l_item as l_string_8 then
Result := utf.utf_8_string_8_to_string_32 (l_string_8)
else
if attached sql_read_string (a_index) as s8 then
Result := s8.to_string_32 -- FIXME: any escape?