# HG changeset patch # User Steve Kemp # Date 1228601746 0 # Node ID d66fefe755ad744c451bc2bcd601a1514788fcbb # Parent 6e34732430db88ae7326e8e71658b8e500b9779a Use UTF-8 charset when processing via textile. Added --charset to set alternate charset if desired. diff -r 6e34732430db -r d66fefe755ad bin/chronicle --- 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); }