Skip to content

Response does not support UTF8 #1

Description

DBSlayer returns its responses in UTF8 format. At present node.dbslayer does not properly set the body encoding when retrieving responses from dbslayer. As such any non-ascii characters in the response data will be corrupted by node.dbslayer. To fix this, change:

request.finish(function(response){
        response.addListener('body', function(data){  
            try {
                var object = JSON.parse(data);

to

request.finish(function(response){
        response.setBodyEncoding("utf8");
        response.addListener('body', function(data){  
            try {
                var object = JSON.parse(data);

The key is the second line of the new version, response.setBodyEncoding("utf8").

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions