Coder Social home page Coder Social logo

Comments (5)

mscdex avatar mscdex commented on September 3, 2024

busboy has a defCharset option that allows you to change the default charset (from the default value of 'utf8'):

var Busboy = require('busboy');
var busboy = new Busboy({ defCharset: 'windows-1251', headers: ... });

If you're using connect-busboy, then you can pass settings directly to busboy:

var busboy = require('connect-busboy');
app.use(busboy({ defCharset: 'windows-1251' }));

from connect-busboy.

K3ler avatar K3ler commented on September 3, 2024

sorry, but i got same error 415 unsupported charset "WINDOWS-1251"

in route, i set

var Busboy = require('busboy');


var payment = {

    result : function(req, res, next) {

        var busboy = new Busboy({ headers: req.headers, defCharset: 'windows-1251'  });

        busboy.on('file', function(fieldname, file, filename, encoding, mimetype) {
          console.log('File [' + fieldname + ']: filename: ' + filename + ', encoding: ' + encoding + ', mimetype: ' + mimetype);
          file.on('data', function(data) {
            console.log('File [' + fieldname + '] got ' + data.length + ' bytes');
          });
          file.on('end', function() {
            console.log('File [' + fieldname + '] Finished');
          });
        });
        busboy.on('field', function(fieldname, val, fieldnameTruncated, valTruncated, encoding, mimetype) {
          console.log('Field [' + fieldname + ']: value: ' + val);
        });
        busboy.on('finish', function() {
          console.log('Done parsing form!');
          res.end();
        });
        req.pipe(busboy);
    }
}

module.exports = payment;

i asked semilar question

http://stackoverflow.com/questions/37056794/bodyparser-urlencode-in-express-4-and-encoding-windows-1251

thanks for help

from connect-busboy.

mscdex avatar mscdex commented on September 3, 2024

If you're getting the same error as the one you show in your SO question, then you're still using body-parser instead of (or before) busboy then. busboy would not generate an error like that.

from connect-busboy.

K3ler avatar K3ler commented on September 3, 2024

Yeesssssssssssss! WORK! You save my life! Thanks!

from connect-busboy.

mscdex avatar mscdex commented on September 3, 2024

Glad to hear you got it working!

from connect-busboy.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.