Skip to content
Browse files

updated docs

git-svn-id: svn+ssh://rubyforge.org/var/svn/builder/trunk@110 b15df707-ad1a-0410-81b8-e991873a3486
  • Loading branch information...
1 parent 4352967 commit c1c9282099ded28e77cd1fb793b26eadfa906278 jimweirich committed Oct 26, 2007
Showing with 18 additions and 0 deletions.
  1. +15 −0 README
  2. +3 −0 lib/builder/xmlmarkup.rb
View
15 README
@@ -126,6 +126,10 @@ incompatibility are:
<b>version</b>:: 1.0
<b>encoding</b>:: "UTF-8"
+ (NOTE: if the encoding is set to "UTF-8" and $KCODE is set to
+ "UTF8", then Builder will emit UTF-8 encoded strings rather than
+ encoding non-ASCII characters as entities.)
+
* XML entity declarations are now supported to a small degree.
xml_markup.declare! :DOCTYPE, :chapter, :SYSTEM, "../dtds/chapter.dtd"
@@ -202,6 +206,17 @@ incompatibility are:
xml.target! =>
"<sample>I&#241;t&#235;rn&#226;ti&#244;n&#224;l</sample>"
+ You can get UTF-8 encoded output by making sure that the XML
+ encoding is set to "UTF-8" and that the $KCODE variable is set to
+ "UTF8".
+
+ $KCODE = 'UTF8'
+ xml = Builder::Markup.new
+ xml.instruct!(:xml, :encoding => "UTF-8")
+ xml.sample("I�t�rn�ti�n�l")
+ xml.target! =>
+ "<sample>I�t�rn�ti�n�l</sample>"
+
== Contact
Author:: Jim Weirich
View
3 lib/builder/xmlmarkup.rb
@@ -235,6 +235,9 @@ def declare!(inst, *args, &block)
# xml.instruct! :aaa, :bbb=>"ccc"
# #=> <?aaa bbb="ccc"?>
#
+ # Note: If the encoding is setup to "UTF-8" and the value of
+ # $KCODE is "UTF8", then builder will emit UTF-8 encoded strings
+ # rather than the entity encoding normally used.
def instruct!(directive_tag=:xml, attrs={})
_ensure_no_block block_given?
if directive_tag == :xml

0 comments on commit c1c9282

Please sign in to comment.
Something went wrong with that request. Please try again.