Commit 62f5565c authored by Jérémy Lal's avatar Jérémy Lal

Imported Upstream version 2.1.8

parent d4ba6bca
......@@ -2,8 +2,65 @@
Text recoding in JavaScript for fun and profit!
node-iconv may or may not work on Windows. Please try it and report any issues
you have.
## Supported encodings
European languages
ASCII, ISO-8859-{1,2,3,4,5,7,9,10,13,14,15,16},
KOI8-R, KOI8-U, KOI8-RU,
CP{437,737,775,850,852,853,855,857,858,860,861,863,865,866,869}
CP{1125,1250,1251,1252,1253,1254,1257}
Mac{Roman,CentralEurope,Iceland,Croatian,Romania},
Mac{Cyrillic,Ukraine,Greek,Turkish},
Macintosh
Semitic languages
ISO-8859-{6,8}, CP{1255,1256}, CP862, CP864, Mac{Hebrew,Arabic}
Japanese
EUC-JP, SHIFT_JIS, CP932, ISO-2022-JP, ISO-2022-JP-2, ISO-2022-JP-1
EUC-JISX0213, Shift_JISX0213, ISO-2022-JP-3
Chinese
EUC-CN, HZ, GBK, CP936, GB18030, EUC-TW, BIG5, CP950, BIG5-HKSCS,
BIG5-HKSCS:2004, BIG5-HKSCS:2001, BIG5-HKSCS:1999, ISO-2022-CN,
ISO-2022-CN-EXT, BIG5-2003 (experimental)
Korean
EUC-KR, CP949, ISO-2022-KR, JOHAB
Turkmen
TDS565
Armenian
ARMSCII-8
Georgian
Georgian-Academy, Georgian-PS
Tajik
KOI8-T
Kazakh
PT154, RK1048
Thai
ISO-8859-11, TIS-620, CP874, MacThai
Laotian
MuleLao-1, CP1133
Vietnamese
VISCII, TCVN, CP1258
Platform specifics
HP-ROMAN8, NEXTSTEP, ATARIST, RISCOS-LATIN1
Full Unicode
UTF-8
UCS-2, UCS-2BE, UCS-2LE
UCS-4, UCS-4BE, UCS-4LE
UTF-16, UTF-16BE, UTF-16LE
UTF-32, UTF-32BE, UTF-32LE
UTF-7
C99, JAVA
Full Unicode, in terms of `uint16_t` or `uint32_t`
(with machine dependent endianness and alignment)
UCS-2-INTERNAL, UCS-4-INTERNAL
Locale dependent, in terms of `char` or `wchar_t`
(with machine dependent endianness and alignment, and with OS and
locale dependent semantics)
char, wchar_t
The empty encoding name "" is equivalent to "char": it denotes the
locale dependent character encoding.
If you don't need the full gamut of encodings, consider using [iconv-lite][].
It supports most common encodings and doesn't require a compiler to install.
## Installing with [npm](http://npmjs.org/)
......@@ -102,3 +159,5 @@ Example usage:
EINVAL is raised when the input ends in a partial character sequence. This is a
feature, not a bug.
[iconv-lite]: https://www.npmjs.org/package/iconv-lite
......@@ -26,14 +26,7 @@
'direct_dependent_settings': {
'include_dirs': ['support'],
},
'defines': [
'ICONV_CONST=const',
'USE_AIX=1',
'USE_DOS=1',
'USE_EXTRA=1',
'USE_OSF1=1',
'LIBDIR="."', # not actually used
],
'defines': ['ICONV_CONST=const', 'ENABLE_EXTRA=1'],
'include_dirs': [
'deps/libiconv/srclib',
'support',
......@@ -47,6 +40,16 @@
'cflags!': ['-W', '-Wall', '-Wextra'],
}],
],
'msvs_settings': {
'VCCLCompilerTool': {
'DisableSpecificWarnings': [
'4018', # Signed/unsigned comparison.
'4090', # Const/non-const mismatch.
'4244', # Narrowing cast.
'4267', # Narrowing cast.
],
},
},
'xcode_settings': {
'WARNING_CFLAGS!': ['-W', '-Wall', '-Wextra'],
'WARNING_CFLAGS': [
......
This diff is collapsed.
#define NO_I18N
#include "iconv.c"
......@@ -14,6 +14,8 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
'use strict';
exports.Iconv = Iconv;
var stream = require('stream');
......
{
"name": "iconv",
"main": "./lib/iconv",
"version": "2.1.4",
"version": "2.1.8",
"description": "Text recoding in JavaScript for fun and profit!",
"homepage": "https://github.com/bnoordhuis/node-iconv",
"repository": {
......@@ -18,7 +18,7 @@
"license": "ISC",
"readmeFilename": "README.md",
"dependencies": {
"nan": "~1.1.1"
"nan": "~1.8.0"
},
"devDependencies": {
"tap": "~0.4.8"
......
......@@ -37,11 +37,6 @@ using v8::Persistent;
using v8::String;
using v8::Value;
// TODO(bnoordhuis) Move back into Iconv sometime. Still broken in nan 1.1.1.
NAN_WEAK_CALLBACK(WeakCallback)
{
delete data.GetParameter();
}
struct Iconv
{
......@@ -58,6 +53,12 @@ struct Iconv
iconv_close(conv_);
}
NAN_WEAK_CALLBACK(WeakCallback)
{
delete data.GetParameter();
}
static void Initialize(Handle<Object> obj)
{
NanScope();
......@@ -85,7 +86,7 @@ struct Iconv
Iconv* iv = new Iconv(conv);
Local<Object> obj = NanNew<ObjectTemplate>(object_template)->NewInstance();
NanSetInternalFieldPointer(obj, 0, iv);
NanMakeWeakPersistent(obj, iv, WeakCallback<Object, Iconv>);
NanMakeWeakPersistent(obj, iv, &WeakCallback);
NanReturnValue(obj);
}
......@@ -118,8 +119,8 @@ struct Iconv
}
input_consumed -= input_size;
output_consumed -= output_size;
rc->Set(0, NanNew<Integer>(input_consumed));
rc->Set(1, NanNew<Integer>(output_consumed));
rc->Set(0, NanNew<Integer>(static_cast<uint32_t>(input_consumed)));
rc->Set(1, NanNew<Integer>(static_cast<uint32_t>(output_consumed)));
NanReturnValue(NanNew<Integer>(errorno));
}
......
#ifndef locale_charset
#define locale_charset(s) ("")
#define locale_charset() ("")
#endif
......@@ -14,6 +14,8 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
'use strict';
var assert = require('assert');
var Iconv = require('../lib/iconv').Iconv;
......@@ -115,3 +117,14 @@ assert.equal(iconv.convert('ça va が').toString(), 'ca va ');
iconv = Iconv('utf-8', 'iso-8859-1');
assert.equal(iconv.convert('b2s=', 'base64').toString(), 'ok');
var aixEncodings =
'CP856 CP922 CP943 CP1046 CP1124 CP1129 CP1161 CP1162 CP1163';
var dosEncodings =
'CP437 CP737 CP775 CP852 CP853 CP855 CP857 CP858 CP860 CP861 ' +
'CP863 CP864 CP865 CP869 CP1125';
// Check that AIX and DOS encodings are available.
aixEncodings.split(' ').forEach(function(name) { Iconv(name, 'utf-8'); })
dosEncodings.split(' ').forEach(function(name) { Iconv(name, 'utf-8'); })
......@@ -14,6 +14,8 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
'use strict';
var Iconv = require('../lib/iconv').Iconv;
var assert = require('assert');
......
......@@ -14,6 +14,8 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
'use strict';
var Iconv = require('../lib/iconv').Iconv;
var assert = require('assert');
var stream = require('stream');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment