Detect encoding of note attachment url.

Created by: maxlazio

If a user attaches a document that contains special characters in the filename( eg. çaão_riaá.doc) to a comment, comment is not displayed. PROJECT/files/ page will also give error 500. This PR solves that.

Unfortunately, the included test is passing even without the fix.

Travis build failed for postgresql but passed for mysql.

合并请求报告