how can i convert ascii code to character in javascript












32















how can i convert ascii code to character in javascript










share|improve this question























  • JavaScript "characters" (like in many modern languages) are UTF-16 code units. If for some strange reason you have an ASCII code unit, you can easily convert it by relying on 1) ASCII code unit are the same as ASCII codepoint, 2) ASCII codepoints are the same as Unicode codepoints (for the characters in common), 3) UTF-16 encodes those characters in one UTF-16 code unit, and 4) those UTF-16 code units, although having 16 bits has the same integer value as the ASCII code units. Or, did you really just have a UTF-16 code unit are for some reason calling it ASCII?

    – Tom Blodget
    Feb 9 '17 at 17:38


















32















how can i convert ascii code to character in javascript










share|improve this question























  • JavaScript "characters" (like in many modern languages) are UTF-16 code units. If for some strange reason you have an ASCII code unit, you can easily convert it by relying on 1) ASCII code unit are the same as ASCII codepoint, 2) ASCII codepoints are the same as Unicode codepoints (for the characters in common), 3) UTF-16 encodes those characters in one UTF-16 code unit, and 4) those UTF-16 code units, although having 16 bits has the same integer value as the ASCII code units. Or, did you really just have a UTF-16 code unit are for some reason calling it ASCII?

    – Tom Blodget
    Feb 9 '17 at 17:38
















32












32








32


8






how can i convert ascii code to character in javascript










share|improve this question














how can i convert ascii code to character in javascript







javascript ascii






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 9 '11 at 11:51









DeepaDeepa

43151020




43151020













  • JavaScript "characters" (like in many modern languages) are UTF-16 code units. If for some strange reason you have an ASCII code unit, you can easily convert it by relying on 1) ASCII code unit are the same as ASCII codepoint, 2) ASCII codepoints are the same as Unicode codepoints (for the characters in common), 3) UTF-16 encodes those characters in one UTF-16 code unit, and 4) those UTF-16 code units, although having 16 bits has the same integer value as the ASCII code units. Or, did you really just have a UTF-16 code unit are for some reason calling it ASCII?

    – Tom Blodget
    Feb 9 '17 at 17:38





















  • JavaScript "characters" (like in many modern languages) are UTF-16 code units. If for some strange reason you have an ASCII code unit, you can easily convert it by relying on 1) ASCII code unit are the same as ASCII codepoint, 2) ASCII codepoints are the same as Unicode codepoints (for the characters in common), 3) UTF-16 encodes those characters in one UTF-16 code unit, and 4) those UTF-16 code units, although having 16 bits has the same integer value as the ASCII code units. Or, did you really just have a UTF-16 code unit are for some reason calling it ASCII?

    – Tom Blodget
    Feb 9 '17 at 17:38



















JavaScript "characters" (like in many modern languages) are UTF-16 code units. If for some strange reason you have an ASCII code unit, you can easily convert it by relying on 1) ASCII code unit are the same as ASCII codepoint, 2) ASCII codepoints are the same as Unicode codepoints (for the characters in common), 3) UTF-16 encodes those characters in one UTF-16 code unit, and 4) those UTF-16 code units, although having 16 bits has the same integer value as the ASCII code units. Or, did you really just have a UTF-16 code unit are for some reason calling it ASCII?

– Tom Blodget
Feb 9 '17 at 17:38







JavaScript "characters" (like in many modern languages) are UTF-16 code units. If for some strange reason you have an ASCII code unit, you can easily convert it by relying on 1) ASCII code unit are the same as ASCII codepoint, 2) ASCII codepoints are the same as Unicode codepoints (for the characters in common), 3) UTF-16 encodes those characters in one UTF-16 code unit, and 4) those UTF-16 code units, although having 16 bits has the same integer value as the ASCII code units. Or, did you really just have a UTF-16 code unit are for some reason calling it ASCII?

– Tom Blodget
Feb 9 '17 at 17:38














2 Answers
2






active

oldest

votes


















73














String.fromCharCode(ascii_code)





share|improve this answer
























  • [link] (developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/…)

    – Elangovan
    Jul 25 '14 at 10:38











  • how can I reconvert, character to code

    – user3851829
    Sep 30 '14 at 5:13






  • 1





    character.charCodeAt(0), for example, 'a'.charCodeAt(0)

    – Darko Kenda
    Sep 30 '14 at 8:31



















3














If you want to convert Ascii Codes to Characters you can use:



String.fromCharCode(codes);


For Example:



String.fromCharCode(65,66,67);

which returns = "ABC"





share|improve this answer























    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f5245368%2fhow-can-i-convert-ascii-code-to-character-in-javascript%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    73














    String.fromCharCode(ascii_code)





    share|improve this answer
























    • [link] (developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/…)

      – Elangovan
      Jul 25 '14 at 10:38











    • how can I reconvert, character to code

      – user3851829
      Sep 30 '14 at 5:13






    • 1





      character.charCodeAt(0), for example, 'a'.charCodeAt(0)

      – Darko Kenda
      Sep 30 '14 at 8:31
















    73














    String.fromCharCode(ascii_code)





    share|improve this answer
























    • [link] (developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/…)

      – Elangovan
      Jul 25 '14 at 10:38











    • how can I reconvert, character to code

      – user3851829
      Sep 30 '14 at 5:13






    • 1





      character.charCodeAt(0), for example, 'a'.charCodeAt(0)

      – Darko Kenda
      Sep 30 '14 at 8:31














    73












    73








    73







    String.fromCharCode(ascii_code)





    share|improve this answer













    String.fromCharCode(ascii_code)






    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered Mar 9 '11 at 11:53









    Darko KendaDarko Kenda

    3,9432131




    3,9432131













    • [link] (developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/…)

      – Elangovan
      Jul 25 '14 at 10:38











    • how can I reconvert, character to code

      – user3851829
      Sep 30 '14 at 5:13






    • 1





      character.charCodeAt(0), for example, 'a'.charCodeAt(0)

      – Darko Kenda
      Sep 30 '14 at 8:31



















    • [link] (developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/…)

      – Elangovan
      Jul 25 '14 at 10:38











    • how can I reconvert, character to code

      – user3851829
      Sep 30 '14 at 5:13






    • 1





      character.charCodeAt(0), for example, 'a'.charCodeAt(0)

      – Darko Kenda
      Sep 30 '14 at 8:31

















    [link] (developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/…)

    – Elangovan
    Jul 25 '14 at 10:38





    [link] (developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/…)

    – Elangovan
    Jul 25 '14 at 10:38













    how can I reconvert, character to code

    – user3851829
    Sep 30 '14 at 5:13





    how can I reconvert, character to code

    – user3851829
    Sep 30 '14 at 5:13




    1




    1





    character.charCodeAt(0), for example, 'a'.charCodeAt(0)

    – Darko Kenda
    Sep 30 '14 at 8:31





    character.charCodeAt(0), for example, 'a'.charCodeAt(0)

    – Darko Kenda
    Sep 30 '14 at 8:31













    3














    If you want to convert Ascii Codes to Characters you can use:



    String.fromCharCode(codes);


    For Example:



    String.fromCharCode(65,66,67);

    which returns = "ABC"





    share|improve this answer




























      3














      If you want to convert Ascii Codes to Characters you can use:



      String.fromCharCode(codes);


      For Example:



      String.fromCharCode(65,66,67);

      which returns = "ABC"





      share|improve this answer


























        3












        3








        3







        If you want to convert Ascii Codes to Characters you can use:



        String.fromCharCode(codes);


        For Example:



        String.fromCharCode(65,66,67);

        which returns = "ABC"





        share|improve this answer













        If you want to convert Ascii Codes to Characters you can use:



        String.fromCharCode(codes);


        For Example:



        String.fromCharCode(65,66,67);

        which returns = "ABC"






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Feb 9 '17 at 1:18









        Saleheen NoorSaleheen Noor

        312




        312






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f5245368%2fhow-can-i-convert-ascii-code-to-character-in-javascript%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Coverage of Google Street View

            Full-time equivalent

            Surfing