V
V
Vasily Shakhunov2015-03-29 00:58:29
Heroku
Vasily Shakhunov, 2015-03-29 00:58:29

How to fix nodejs output transliteration on heroku?

There is a small nodejs application that communicates with the vk api. Actually the express server raises the server, requests api and concludes:

app.get('/', function (req, response) {
    vk.request('groups.getMembers', {
        'group_id': '121314',
        'count': 1000,
        'fields': 'city'
    });

    vk.on('done:groups.getMembers', function(res){
        var cityStat = {};
        for (item in res.response.items){
            var people = res.response.items[item];
            if (typeof people.city !== 'undefined'){
                if (typeof cityStat[people.city.title] == 'undefined'){
                    cityStat[people.city.title] = 1;
                } else {
                    cityStat[people.city.title] += 1;
                }
            }
        }
        var sortedList = utils.sortObj(cityStat, 'asc')
        response.end(JSON.stringify(cityStat, null, '\t'));

    });

Actually a problem. On a local laptop, the output is in Cyrillic:
{
  "Ярославль": 8,
  "Москва": 62,
  "Санкт-Петербург": 63,
}

And the application hosted on heroku produces a transliteration:
{
  "Yaroslavl": 7,
  "Moscow": 62,
  "Saint Petersburg": 63,
}

Why might it be so?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question