telize

High performance JSON IP and GeoIP REST API (IP Geolocation)
Log | Files | Refs | README | LICENSE

commit 6852a9e649a9f452573fe1f903c78f05b3431c30
parent a7ffde67d3d7bdba5c326d58c5e230be45f171f7
Author: Yann VERRY <yann@verry.org>
Date:   Wed,  9 Jul 2014 17:44:04 +0200

convert geop iso to utf8 need lua-iconv

Diffstat:
MREADME.md | 3++-
Mtelize | 8+++++---
2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/README.md b/README.md @@ -39,10 +39,11 @@ modules compiled-in. Telize requires the following Lua module : - Lua CJSON +- Lua iconv Installing via LuaRocks : - luarocks install lua-cjson + luarocks install lua-cjson lua-iconv ### GeoIP databases diff --git a/telize b/telize @@ -60,7 +60,7 @@ server { location /jsonify { access_log off; - charset iso-8859-1; + charset utf8; default_type application/json; if ($arg_org ~* "^(AS[0-9]+) (.+)") { @@ -69,7 +69,9 @@ server { } content_by_lua ' - local cjson = require("cjson") + local cjson = require("cjson") + local iconv = require("iconv") + local cd = iconv.new("utf-8","iso-8859-15") local callback = ngx.var.arg_callback @@ -80,7 +82,7 @@ server { country = ngx.var.arg_country, region = ngx.var.arg_region, region_code = ngx.var.arg_region_code, - city = ngx.var.arg_city, + city = cd:iconv(ngx.var.arg_city), postal_code = ngx.var.arg_postal_code, continent_code = ngx.var.arg_continent_code, latitude = ngx.var.arg_latitude,