This commit is contained in:
Andreas Bielawski
2016-09-07 13:07:36 +02:00
3 changed files with 40 additions and 17 deletions

View File

@ -20,7 +20,6 @@
local utilities = {}
utf8 = require 'lua-utf8'
ltn12 = require('ltn12')
http = require('socket.http')
https = require('ssl.https')
@ -33,6 +32,9 @@ redis = (loadfile "./otouto/redis.lua")()
mime = (loadfile "./otouto/mimetype.lua")()
OAuth = require "OAuth"
helpers = require "OAuth.helpers"
-- Lua 5.2 compatibility.
-- If no built-in utf8 is available, load the library.
local utf8 = utf8 or require('lua-utf8')
http.timeout = 5
https.timeout = 5
@ -1101,7 +1103,8 @@ end
-- Converts a gross string back into proper UTF-8.
-- Useful for fixing improper encoding caused by bad JSON escaping.
function utilities.fix_utf8(str)
return string.char(utf8.codepoint(str, 1, -1))
return string.char(utf8.codepoint(str, 1, -1))
end
return utilities