diff -Naru src.orig/edoc_doclet.erl src/edoc_doclet.erl --- src.orig/edoc_doclet.erl Mon Jan 29 21:58:33 2007 +++ src/edoc_doclet.erl Tue Oct 2 09:01:56 2007 @@ -346,7 +346,16 @@ xhtml_1(Title, CSS, Body) -> {html, [?NL, - {head, [?NL, {title, [Title]}, ?NL] ++ CSS}, + {head, + [?NL, + {meta, [{'http-equiv', "Content-Type"}, + {content, "text/html; charset=UTF-8"}], + []}, + ?NL, + {title, [Title]}, + ?NL + ] ++ CSS + }, ?NL, Body, ?NL] diff -Naru src.orig/edoc_layout.erl src/edoc_layout.erl --- src.orig/edoc_layout.erl Tue Mar 27 22:35:20 2007 +++ src/edoc_layout.erl Mon Oct 1 21:53:09 2007 @@ -539,7 +539,7 @@ case get_content(copyright, Es) of [] -> []; Es1 -> - [{p, ["Copyright \251 " | Es1]}, ?NL] + [{p, ["Copyright \302\251 " | Es1]}, ?NL] end. version(Es) -> @@ -790,9 +790,15 @@ xhtml(Title, CSS, Body) -> [{html, [?NL, - {head, [?NL, - {title, [Title]}, - ?NL] ++ CSS}, + {head, + [?NL, + {meta, [{'http-equiv', "Content-Type"}, + {content, "text/html; charset=UTF-8"}], + []}, + ?NL, + {title, [Title]}, + ?NL] ++ CSS + }, ?NL, {body, [{bgcolor, "white"}], Body}, ?NL] diff -Naru src.orig/edoc_utf8.erl src/edoc_utf8.erl --- src.orig/edoc_utf8.erl Thu Jan 1 09:00:00 1970 +++ src/edoc_utf8.erl Tue Oct 2 09:18:40 2007 @@ -0,0 +1,43 @@ +%% @doc Convert 'Unicode code-point values' to 'UTF-8 encoded byte values' +%% in XML content data. +%% + +-module(edoc_utf8). +-export([xml_content_to_utf8/1]). +-include_lib("xmerl/include/xmerl.hrl"). + +%% @spec xml_content_to_utf8(XmlContent) -> XmlContent +%% where +%% XmlContent = [XmlText|XmlElement] +%% +xml_content_to_utf8(Content) -> con_to_utf8(Content). + +%% private stuffs + +con_to_utf8(Content) -> lists:reverse(con_to_utf8_rev(Content, [])). + +con_to_utf8_rev([], Processed) -> Processed; +con_to_utf8_rev([Text|Rest], Processed) when is_record(Text, xmlText) -> + Utf8Text = Text#xmlText{value = xmerl_ucs:to_utf8(Text#xmlText.value)}, + con_to_utf8_rev(Rest, [Utf8Text|Processed]); +con_to_utf8_rev([Element|Rest], Processed) when is_record(Element, xmlElement) -> + Utf8Element = elm_to_utf8(Element), + con_to_utf8_rev(Rest, [Utf8Element|Processed]). + +elm_to_utf8(Element) -> + Element#xmlElement{ + content = con_to_utf8(Element#xmlElement.content), + attributes = lists:map(fun attr_to_utf8/1, Element#xmlElement.attributes) + }. + +attr_to_utf8(Attr) when is_record(Attr, xmlAttribute) -> + Val = Attr#xmlAttribute.value, + StrVal = + if + is_list(Val) -> Val; + is_atom(Val) -> atom_to_list(Val); + is_integer(Val) -> integer_to_list(Val) + end, + Attr#xmlAttribute{value = xmerl_ucs:to_utf8(StrVal)}. + + diff -Naru src.orig/edoc_wiki.erl src/edoc_wiki.erl --- src.orig/edoc_wiki.erl Mon Jan 29 21:58:47 2007 +++ src/edoc_wiki.erl Mon Oct 1 17:49:14 2007 @@ -84,7 +84,7 @@ Text1 = "" ++ Text ++ "", case catch {ok, xmerl_scan:string(Text1, [{line, Line}])} of {ok, {E, _}} -> - E#xmlElement.content; + edoc_utf8:xml_content_to_utf8(E#xmlElement.content); {'EXIT', {fatal, {Reason, L, _C}}} -> throw_error(L, {"XML parse error: ~p.", [Reason]}); {'EXIT', Reason} -> diff -Naru src.orig/recompile.bat src/recompile.bat --- src.orig/recompile.bat Thu Jan 1 09:00:00 1970 +++ src/recompile.bat Tue Oct 2 09:13:23 2007 @@ -0,0 +1 @@ +erlc -I ../../xmerl-1.1.2/include -o ../ebin edoc_doclet.erl edoc_layout.erl edoc_utf8.erl edoc_wiki.erl