You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ponymail.apache.org by hu...@apache.org on 2018/10/15 09:43:11 UTC

[incubator-ponymail] branch master updated: Enforce UTF-8 character sets

This is an automated email from the ASF dual-hosted git repository.

humbedooh pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-ponymail.git


The following commit(s) were added to refs/heads/master by this push:
     new 115354e  Enforce UTF-8 character sets
115354e is described below

commit 115354e3072602ac0d7e02725db1c6ae9299cf50
Author: Daniel Gruno <hu...@apache.org>
AuthorDate: Mon Oct 15 11:42:54 2018 +0200

    Enforce UTF-8 character sets
    
    This enforces UTF-8 in character sets for JSON/ATOM payloads,
    which is needed for some scrapers. Fixes #479.
---
 CHANGELOG.md        | 1 +
 site/api/atom.lua   | 4 ++--
 site/api/email.lua  | 4 ++--
 site/api/stats.lua  | 2 +-
 site/api/thread.lua | 2 +-
 5 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 46ffb8f..a904931 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,4 +1,5 @@
 ## Changes in 0.11-SNAPSHOT
+- Enh: Enforce UTF-8 in content headers (#479)
 - Bug: elastic.lua#scroll forces sort to use _doc (#478)
 - Bug: cannot download more than 10K mails to a mbox file (#475)
 - Bug: no need to sort after scroll (#477)
diff --git a/site/api/atom.lua b/site/api/atom.lua
index 546db0c..2b3ea9a 100644
--- a/site/api/atom.lua
+++ b/site/api/atom.lua
@@ -48,7 +48,7 @@ local function fetchChildren(r, pdoc, c, biglist)
 end
 
 function handle(r)
-    cross.contentType(r, "application/xhtml+xml")
+    cross.contentType(r, "application/xhtml+xml; charset=UTF-8")
     local get = r:parseargs()
 
     -- make sure we have a list or a thread to display results from
@@ -197,4 +197,4 @@ function handle(r)
     return cross.OK
 end
 
-cross.start(handle)
\ No newline at end of file
+cross.start(handle)
diff --git a/site/api/email.lua b/site/api/email.lua
index 43c697e..292df00 100644
--- a/site/api/email.lua
+++ b/site/api/email.lua
@@ -27,7 +27,7 @@ local utils = require 'lib/utils'
 local mime = require "mime"
 
 function handle(r)
-    cross.contentType(r, "application/json")
+    cross.contentType(r, "application/json; charset=UTF-8")
     local get = r:parseargs()
     -- get the parameter (if any) and tidy it up
     local eid = (get.id or ""):gsub("\"", "")
@@ -117,4 +117,4 @@ function handle(r)
     return cross.OK
 end
 
-cross.start(handle)
\ No newline at end of file
+cross.start(handle)
diff --git a/site/api/stats.lua b/site/api/stats.lua
index bdb28f5..3e6eb65 100644
--- a/site/api/stats.lua
+++ b/site/api/stats.lua
@@ -60,7 +60,7 @@ local function extractCanonName(from)
 end
 
 function handle(r)
-    cross.contentType(r, "application/json")
+    cross.contentType(r, "application/json; charset=UTF-8")
     local DEBUG = config.debug or false
     local t = {}
     local START = DEBUG and r:clock() or nil
diff --git a/site/api/thread.lua b/site/api/thread.lua
index bf67f70..741ac28 100644
--- a/site/api/thread.lua
+++ b/site/api/thread.lua
@@ -70,7 +70,7 @@ local function fetchChildren(r, pdoc, c, biglist, account)
 end
 
 function handle(r)
-    cross.contentType(r, "application/json")
+    cross.contentType(r, "application/json; charset=UTF-8")
     local DEBUG = config.debug or false
     local START = DEBUG and r:clock() or nil
     local get = r:parseargs()