use utf-8 encoding
authorDobrica Pavlinusic <dpavlin@rot13.org>
Fri, 2 Apr 2010 11:42:42 +0000 (13:42 +0200)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Fri, 2 Apr 2010 11:42:42 +0000 (13:42 +0200)
lib/MojoFacets/Data.pm
templates/layouts/default.html.ep

index 71a0a04..5438b52 100644 (file)
@@ -8,6 +8,7 @@ use base 'Mojolicious::Controller';
 use Data::Dump qw(dump);
 use File::Slurp;
 use JSON;
+use Encode;
 
 sub index {
        my $self = shift;
@@ -34,7 +35,11 @@ sub load {
        die "$path $!" unless -r $path;
 
        # we could use Mojo::JSON here, but it's too slow
-       $data = from_json read_file $path;
+#      $data = from_json read_file $path;
+       $data = read_file $path;
+       Encode::_utf8_on($data);
+       warn "# json snippet: ", substr($data,0,200);
+       $data = from_json $data;
 
        foreach my $e ( @{ $data->{items} } ) {
                foreach my $n ( keys %$e ) {
index e3b6053..c3319f9 100644 (file)
@@ -1,6 +1,9 @@
 <!doctype html><html>
-    <head><title>Welcome</title></head>
-    <body>
+<head>
+<meta charset=utf-8>
+<title>Mojo Facets <%= session 'title' %></title>
+</head>
+<body>
 
 <a href="<%= url_for( action => 'index' ) %>">load</a>
 <a href="<%= url_for( action => 'columns' ) %>">columns</a>
@@ -8,5 +11,5 @@
 
 <%== content %>
 
-       </body>
+</body>
 </html>