changeset 287:d66fefe755ad

Use UTF-8 charset when processing via textile. Added --charset to set alternate charset if desired.
author Steve Kemp <steve@steve.org.uk>
date Sat, 06 Dec 2008 22:15:46 +0000
parents 6e34732430db
children a86f5aad9966
files bin/chronicle
diffstat 1 files changed, 23 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/bin/chronicle	Sun Nov 02 16:56:51 2008 +0000
+++ b/bin/chronicle	Sat Dec 06 22:15:46 2008 +0000
@@ -487,6 +487,11 @@
     $CONFIG{ 'force' } = 0;
 
     #
+    #  UTF-8 for textile
+    #
+    $CONFIG{ 'charset' } = 'utf-8';
+
+    #
     #  Comments enabled globally.
     #
     $CONFIG{ 'comment-days' } = 0;
@@ -544,7 +549,8 @@
             "comment-days=s", \$CONFIG{ 'comment-days' },
 
             # input format.
-            "format=s", \$CONFIG{ 'format' },
+            "format=s",  \$CONFIG{ 'format' },
+            "charset=s", \$CONFIG{ 'charset' },
 
             # prefix
             "url-prefix=s", \$CONFIG{ 'url_prefix' },
@@ -2308,10 +2314,23 @@
     }
 
     #
-    #  Convert.
+    #  Convert, via the textile helper.
     #
-    $text = Text::Textile::textile($text);
-    return ($text);
+    my $textile = new Text::Textile;
+
+    if ( defined( $CONFIG{ 'charset' } ) )
+    {
+        $CONFIG{ 'verbose' } &&
+          print "Formatting via textile with charset $CONFIG{'charset'}\n";
+
+        $textile->charset( $CONFIG{ 'charset' } );
+    }
+
+    #
+    #  Now return HTML
+    #
+    my $html = $textile->process($text);
+    return ($html);
 }