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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -100,6 +100,7 @@ feature -- Forms ...
local local
ti: WSF_FORM_TEXT_INPUT ti: WSF_FORM_TEXT_INPUT
l_uri: detachable READABLE_STRING_8 l_uri: detachable READABLE_STRING_8
l_iri: detachable READABLE_STRING_32
do do
-- Path alias -- Path alias
create ti.make ("path_alias") create ti.make ("path_alias")
@@ -111,7 +112,8 @@ feature -- Forms ...
if attached a_node.link as lnk then if attached a_node.link as lnk then
l_uri := lnk.location l_uri := lnk.location
else 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 end
ti.set_text_value (l_uri) 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.") 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
end end
update_node (response: NODE_RESPONSE; fd: WSF_FORM_DATA; a_node: CMS_NODE) update_node (response: NODE_RESPONSE; fd: WSF_FORM_DATA; a_node: CMS_NODE)
local local
b,s: detachable READABLE_STRING_8 b,s: detachable READABLE_STRING_32
f: detachable CONTENT_FORMAT f: detachable CONTENT_FORMAT
do do
if attached fd.integer_item ("id") as l_id and then l_id > 0 then 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 new_node (response: NODE_RESPONSE; fd: WSF_FORM_DATA; a_node: detachable CMS_NODE): G
-- <Precursor> -- <Precursor>
local local
b,s: detachable READABLE_STRING_8 b,s: detachable READABLE_STRING_32
f: detachable CONTENT_FORMAT f: detachable CONTENT_FORMAT
l_node: detachable like new_node l_node: detachable like new_node
do do
@@ -304,7 +305,7 @@ feature -- Output
s.append ("<div class=%"info%"> ") s.append ("<div class=%"info%"> ")
if attached a_node.author as l_author then if attached a_node.author as l_author then
s.append (" by ") s.append (" by ")
s.append (l_author.name) s.append (a_response.html_encoded (l_author.name))
end end
if attached a_node.modification_date as l_modified then if attached a_node.modification_date as l_modified then
s.append (" (modified: ") s.append (" (modified: ")
@@ -321,9 +322,9 @@ feature -- Output
-- if attached a_node.summary as l_summary then -- if attached a_node.summary as l_summary then
-- s.append ("<p class=%"summary%">") -- s.append ("<p class=%"summary%">")
-- if attached node_api.cms_api.format (a_node.format) as f then -- 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 -- else
-- s.append (a_response.formats.default_format.formatted_output (l_summary)) -- append_formatted_output (l_content, a_response.formats.default_format, s)
-- end -- end
-- s.append ("</p>") -- s.append ("</p>")
@@ -333,9 +334,9 @@ feature -- Output
if attached a_node.content as l_content then if attached a_node.content as l_content then
s.append ("<p class=%"content%">") s.append ("<p class=%"content%">")
if attached node_api.cms_api.format (a_node.format) as f then 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 else
s.append (a_response.formats.default_format.formatted_output (l_content)) append_formatted_output (l_content, a_response.formats.default_format, s)
end end
s.append ("</p>") s.append ("</p>")
@@ -346,5 +347,15 @@ feature -- Output
a_response.set_main_content (s) a_response.set_main_content (s)
end 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 end

View File

@@ -575,7 +575,7 @@ feature {NONE} -- Implementation
if attached sql_read_string_32 (5) as l_summary then if attached sql_read_string_32 (5) as l_summary then
Result.set_summary (l_summary) Result.set_summary (l_summary)
end 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) Result.set_content (l_content)
end end
if attached sql_read_string (7) as l_format then 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'. -- Retrieved value at `a_index' position in `item'.
local local
l_item: like sql_item l_item: like sql_item
utf: UTF_CONVERTER
do do
-- FIXME: handle string_32 ! -- FIXME: handle string_32 !
l_item := sql_item (a_index) l_item := sql_item (a_index)
if attached {READABLE_STRING_32} l_item as l_string then if attached {READABLE_STRING_32} l_item as l_string then
Result := l_string 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 else
if attached sql_read_string (a_index) as s8 then if attached sql_read_string (a_index) as s8 then
Result := s8.to_string_32 -- FIXME: any escape? Result := s8.to_string_32 -- FIXME: any escape?