Skip to content
This repository
  • 2 commits
  • 2 files changed
  • 0 comments
  • 1 contributor
17  lib/formidable/incoming_form.js
@@ -5,7 +5,7 @@ var sys = require('sys')
5 5
   , WriteStream = require('fs').WriteStream
6 6
   , MultipartParser = require('./multipart_parser').MultipartParser
7 7
   , QuerystringParser = require('./querystring_parser').QuerystringParser
8  
-  , Utf8Decoder = require('utf8decoder').Utf8Decoder
  8
+  , StringDecoder = require('string_decoder').StringDecoder
9 9
   , EventEmitter = require('events').EventEmitter;
10 10
 
11 11
 function IncomingForm() {
@@ -130,21 +130,10 @@ IncomingForm.prototype.handlePart = function(part) {
130 130
 
131 131
   if (!part.filename) {
132 132
     var value = ''
133  
-      , decoder;
134  
-
135  
-    if (this.encoding.toLowerCase() == 'utf-8') {
136  
-      decoder = new Utf8Decoder();
137  
-      decoder.onString = function(str) {
138  
-        value += str;
139  
-      };
140  
-    }
  133
+      , decoder = new StringDecoder(this.encoding);
141 134
 
142 135
     part.addListener('data', function(buffer) {
143  
-      if (decoder) {
144  
-        decoder.write(buffer);
145  
-      } else {
146  
-        value += buffer.toString(self.encoding);
147  
-      }
  136
+      value += decoder.write(buffer);
148 137
     });
149 138
 
150 139
     part.addListener('end', function() {
2  package.json
... ...
@@ -1,5 +1,5 @@
1 1
 { "name" : "formidable"
2  
-, "version": "0.9.2"
  2
+, "version": "0.9.3"
3 3
 , "dependencies": {"gently": ">=0.7.0"}
4 4
 , "directories" : { "lib" : "./lib/formidable" }
5 5
 , "main" : "./lib/formidable/index"

No commit comments for this range

Something went wrong with that request. Please try again.