diff options
author | Dave Whiteland <dave@mysociety.org> | 2012-12-21 14:44:42 +0000 |
---|---|---|
committer | Dave Whiteland <dave@mysociety.org> | 2012-12-21 14:50:34 +0000 |
commit | ab7afc8736526e260894d09d5ee68ab91a644348 (patch) | |
tree | dcb33351bef1fee6d130c5f429d44f82bb60ac79 /bin | |
parent | dddee71274df4b7d1c25698c143b0367d5158143 (diff) |
Oxfordshire: whoops, from_to is in-place; fixed it but didn't commit promptly
Also make it clear that encoding can be disabled from config file.
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/oxfordshire/open311_service_request.cgi | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/bin/oxfordshire/open311_service_request.cgi b/bin/oxfordshire/open311_service_request.cgi index 977840d69..821295ac7 100755 --- a/bin/oxfordshire/open311_service_request.cgi +++ b/bin/oxfordshire/open311_service_request.cgi @@ -10,11 +10,11 @@ use strict; use CGI; use Time::Piece; -use Encode qw(encode); +use Encode qw(from_to); use DBI; use DBD::Oracle qw(:ora_types); ### for local testing (no Oracle): -#use constant { ORA_VARCHAR2=>1, ORA_DATE=>1, ORA_NUMBER=>1}; +# use constant { ORA_VARCHAR2=>1, ORA_DATE=>1, ORA_NUMBER=>1}; ################################################################### # Config file: values in the config file override any values set @@ -26,6 +26,7 @@ use DBD::Oracle qw(:ora_types); # username: foo # password: FooBar # testing: 0 +# encode-to-win1252: 1 # # Absence of the config file fails silently in case you really are # using values directly set in this script. @@ -420,7 +421,7 @@ sub strip { $s =~ s/[^\t\n[:^cntrl:]]/ /g; # leave tabs and newlines } } - $s = encode('Windows-1252', $s, sub { "?"; } ) if $ENCODE_TO_WIN1252; + from_to($s, 'utf8', 'Windows-1252') if $ENCODE_TO_WIN1252; return $max_len? substr($s, 0, 2000) : $s; } |