Git Product home page Git Product logo

Comments (7)

huynh-duc-mulodo avatar huynh-duc-mulodo commented on May 23, 2024 1

Actually I used var outputArray = Encoding.convert(inputArray, 'UNICODE', 'SJIS'); already. But I need to convert to UTF8 because I'm importing data into Salesforce platform. So the way I fixed this problem is not to use Encoding.codeToString. Instead of that, I came up with using

function arrayToString(uintArray) {
            var encodedString = String.fromCharCode.apply(null, uintArray),
                decodedString = decodeURIComponent(escape(encodedString));
            return decodedString;
        }

from encoding.js.

polygonplanet avatar polygonplanet commented on May 23, 2024 1

Encoding.codeToString uses String.fromCharCode.apply(null, code) internally. Just making sure not to cause an RangeError when it is a large string.

from encoding.js.

huynh-duc-mulodo avatar huynh-duc-mulodo commented on May 23, 2024 1

Thanks for your reminding me of potential problems. I should apply library's method with a little bit of change

function arrayToString(uintArray) {
            var encodedString = Encoding.codeToString(uintArray);
            var decodedString = decodeURIComponent(escape(encodedString));
            return decodedString;
        }

from encoding.js.

huynh-duc-mulodo avatar huynh-duc-mulodo commented on May 23, 2024

Actually, the method codeToString should not be used in this case. It seems to be used for 16bit-based converting

from encoding.js.

polygonplanet avatar polygonplanet commented on May 23, 2024

What is originalText string?

from encoding.js.

huynh-duc-mulodo avatar huynh-duc-mulodo commented on May 23, 2024

hello, originalText is data was read from file which is in SJIS encode

from encoding.js.

polygonplanet avatar polygonplanet commented on May 23, 2024

Maybe, I think that the character code you are looking for is "Unicode".
"Unicode" is JavaScript's encoding, "UTF-8" is not JavaScript internal encoding.

var outputArray = Encoding.convert(inputArray, 'UNICODE', 'SJIS');

from encoding.js.

Related Issues (15)

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.