Revision 140

Date:
2008/05/30 22:02:19
Author:
dpavlin
Revision Log:
fix encoding

on-disk php files are in ISO-8859-2, so support that and require
that PostgreSQL encoding is UTF-8
Files:

Legend:

 
Added
 
Removed
 
Modified
  • bin/db-init.sh

     
    1 1 kill `cat var/jifty-server.pid`
    2 2 psql -l -t -A | grep ^a3c | cut -d\| -f1 | xargs -i dropdb {}
    3 createdb --encoding utf8 a3c
    3 4 jifty schema
    4 ./bin/towns.pl
    5 #./bin/towns.pl
  • lib/A3C/PHP.pm

     
    4 4 use Parse::RecDescent;
    5 5 use Data::Dump qw/dump/;
    6 6 use File::Slurp;
    7 use Encode qw/decode/;
    7 8
    8 9 =head1 NAME
    9 10
     
    16 17
    17 18 It currently ignores C<include> PHP function.
    18 19
    20 =head1 CONFIG
    21
    22 $A3C::PHP::debug = 0;
    23 $A3C::PHP::charset = 'iso-8859-2';
    24
    19 25 =head1 METHODS
    20 26
    21 27 =cut
    22 28
    23 29 our $debug = 0;
    30 our $charset = 'iso-8859-2';
    24 31
    25 32 our $perl = '';
    26 33 our $data;
     
    126 133 $perl = '';
    127 134 if ( $debug ) {
    128 135 $::RD_TRACE = 1;
    129 warn "PHP: $php\n";
    136 warn "PHP [$charset]: $php\n";
    130 137 }
    131 138 my $parser = Parse::RecDescent->new( $grammar );
    132 $parser->php_vars( $php );
    139 $parser->php_vars( decode($charset,$php) );
    133 140 warn "## GENERATED PERL:\n\n", $perl, "\n\n" if $debug;
    134 141 my $data;
    135 142 eval $perl;
  • Makefile.PL

     
    13 13 requires 'JSON::XS';
    14 14 requires 'Parse::RecDescent';
    15 15 requires 'File::Find';
    16 requires 'Encode';
    16 17
    17 18 auto_install;
    18 19