UNPKG

node-red-contrib-iconv

Version:

A Node-RED node based on iconv-lite for encoding or decoding conversion to pure JS encoding

70 lines (63 loc) 3.14 kB
<!-- Copyright 2017 Tiago Machado Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> <script type="text/x-red" data-template-name="converter"> <div class="form-row"> <label for="node-input-from"><i class="fa fa-sign-in"></i> <span data-i18n="converter.label.from"></span></label> <input type="text" id="node-input-from" data-i18n="[placeholder]converter.input.from"> </div> <div class="form-row"> <label for="node-input-name"><i class="fa fa-tag"></i> <span data-i18n="converter.label.name"></span></label> <input type="text" id="node-input-name" data-i18n="[placeholder]converter.label.name"> </div> </script> <script type="text/x-red" data-help-name="converter"> <p>For decoding simply send a Buffer inside <code>msg.payload</code> and the choosed encoding format will be applied to convert it to pure Javascript chracter encoding.</p> <p>For encoding simply send a String inside <code>msg.payload</code> and the choosed encoding format will be applied to convert.</p> <ul>Supported Encodings</ul> <li>Node.js Native encodings: utf8, ucs2 / utf16le, ascii, binary, base64, hex</li> <li>Unicode: UTF-16BE, UTF-16 (with BOM)</li> <li>Windows codepages: 874, 1250-1258 (aliases: cpXXX, winXXX, windowsXXX)</li> <li>ISO codepages: ISO-8859-1 - ISO-8859-16</li> <li>IBM codepages: 437, 737, 775, 808, 850, 852, 855-858, 860-866, 869, 922, 1046, 1124, 1125, 1129, 1133, 1161-1163 (aliases cpXXX, ibmXXX)</li> <li>Mac codepages: maccroatian, maccyrillic, macgreek, maciceland, macroman, macromania, macthai, macturkish, macukraine, maccenteuro, macintosh</li> <li>KOI8 codepages: koi8-r, koi8-u, koi8-ru, koi8-t</li> <li>Miscellaneous: armscii8, rk1048, tcvn, georgianacademy, georgianps, pt154, viscii, iso646cn, iso646jp, hproman8, tis620</li> <li>Japanese: Shift_JIS, Windows-31j, Windows932, EUC-JP</li> <li>Chinese: GB2312, GBK, GB18030, Windows936, EUC-CN</li> <li>Korean: KS_C_5601, Windows949, EUC-KR</li> <li>Taiwan/Hong Kong: Big5, Big5-HKSCS, Windows950</li> </script> <script type="text/javascript"> RED.nodes.registerType('converter',{ category: 'function', color:"#DEBD5C", defaults: { name: { value:"" }, from: { value:"", required:true } }, inputs:1, outputs:1, icon: "arrow-in.png", label: function() { return this.name||"charset"; }, labelStyle: function() { return this.name?"node_label_italic":""; } }); </script>