Getting Error Message While Saving Emojis With Text Data











up vote
2
down vote

favorite












I am trying to save emojis along with text data to postgressql database with version PostgreSQL 9.4.15 and encoding UTF8 in my Spring MVC Web application. I had used database Default collation in utf8. I am able to save the emojis along with text data in the database, but while retrieving the rows using my dao method, it is showing an error like below.




Invalid character data was found. This is most likely caused by
stored data containing characters that are invalid for the character
set the database was created in. The most common example of this is
storing 8bit data in an SQL_ASCII database.




My friend end is xamarin forms PCL project, Is there any way to fix this issue from front end itself or any solution from the backend?



Thanks in advance










share|improve this question
























  • use a different character set
    – Stultuske
    Nov 20 at 12:48















up vote
2
down vote

favorite












I am trying to save emojis along with text data to postgressql database with version PostgreSQL 9.4.15 and encoding UTF8 in my Spring MVC Web application. I had used database Default collation in utf8. I am able to save the emojis along with text data in the database, but while retrieving the rows using my dao method, it is showing an error like below.




Invalid character data was found. This is most likely caused by
stored data containing characters that are invalid for the character
set the database was created in. The most common example of this is
storing 8bit data in an SQL_ASCII database.




My friend end is xamarin forms PCL project, Is there any way to fix this issue from front end itself or any solution from the backend?



Thanks in advance










share|improve this question
























  • use a different character set
    – Stultuske
    Nov 20 at 12:48













up vote
2
down vote

favorite









up vote
2
down vote

favorite











I am trying to save emojis along with text data to postgressql database with version PostgreSQL 9.4.15 and encoding UTF8 in my Spring MVC Web application. I had used database Default collation in utf8. I am able to save the emojis along with text data in the database, but while retrieving the rows using my dao method, it is showing an error like below.




Invalid character data was found. This is most likely caused by
stored data containing characters that are invalid for the character
set the database was created in. The most common example of this is
storing 8bit data in an SQL_ASCII database.




My friend end is xamarin forms PCL project, Is there any way to fix this issue from front end itself or any solution from the backend?



Thanks in advance










share|improve this question















I am trying to save emojis along with text data to postgressql database with version PostgreSQL 9.4.15 and encoding UTF8 in my Spring MVC Web application. I had used database Default collation in utf8. I am able to save the emojis along with text data in the database, but while retrieving the rows using my dao method, it is showing an error like below.




Invalid character data was found. This is most likely caused by
stored data containing characters that are invalid for the character
set the database was created in. The most common example of this is
storing 8bit data in an SQL_ASCII database.




My friend end is xamarin forms PCL project, Is there any way to fix this issue from front end itself or any solution from the backend?



Thanks in advance







java postgresql spring-mvc xamarin.forms






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Dec 3 at 10:57

























asked Nov 20 at 12:46









K.Sumith

6818




6818












  • use a different character set
    – Stultuske
    Nov 20 at 12:48


















  • use a different character set
    – Stultuske
    Nov 20 at 12:48
















use a different character set
– Stultuske
Nov 20 at 12:48




use a different character set
– Stultuske
Nov 20 at 12:48












3 Answers
3






active

oldest

votes

















up vote
1
down vote



accepted










It is very easy to solve this issue from the front end. Since your front end is xamarin forms you need to encode the contents before sending it into the server and decode the content when you retrieve.



 System.Net.WebUtility.UrlEncode(*string*); // Encode
System.Net.WebUtility.UrlDecode(*string*); // Decode





share|improve this answer




























    up vote
    2
    down vote













    Another option to try: Client needs to encode message in base 64 before sending to server and decode back to base 64 before returning the data back to client. This should make the emojis work on the client applications.






    share|improve this answer




























      up vote
      1
      down vote













      You may have to refer the following article The ultimate guide to Emojis to get some insight in to how this can be handled.






      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',
        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%2f53393318%2fgetting-error-message-while-saving-emojis-with-text-data%23new-answer', 'question_page');
        }
        );

        Post as a guest















        Required, but never shown

























        3 Answers
        3






        active

        oldest

        votes








        3 Answers
        3






        active

        oldest

        votes









        active

        oldest

        votes






        active

        oldest

        votes








        up vote
        1
        down vote



        accepted










        It is very easy to solve this issue from the front end. Since your front end is xamarin forms you need to encode the contents before sending it into the server and decode the content when you retrieve.



         System.Net.WebUtility.UrlEncode(*string*); // Encode
        System.Net.WebUtility.UrlDecode(*string*); // Decode





        share|improve this answer

























          up vote
          1
          down vote



          accepted










          It is very easy to solve this issue from the front end. Since your front end is xamarin forms you need to encode the contents before sending it into the server and decode the content when you retrieve.



           System.Net.WebUtility.UrlEncode(*string*); // Encode
          System.Net.WebUtility.UrlDecode(*string*); // Decode





          share|improve this answer























            up vote
            1
            down vote



            accepted







            up vote
            1
            down vote



            accepted






            It is very easy to solve this issue from the front end. Since your front end is xamarin forms you need to encode the contents before sending it into the server and decode the content when you retrieve.



             System.Net.WebUtility.UrlEncode(*string*); // Encode
            System.Net.WebUtility.UrlDecode(*string*); // Decode





            share|improve this answer












            It is very easy to solve this issue from the front end. Since your front end is xamarin forms you need to encode the contents before sending it into the server and decode the content when you retrieve.



             System.Net.WebUtility.UrlEncode(*string*); // Encode
            System.Net.WebUtility.UrlDecode(*string*); // Decode






            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Dec 3 at 11:05









            Sreejith Sree

            363112




            363112
























                up vote
                2
                down vote













                Another option to try: Client needs to encode message in base 64 before sending to server and decode back to base 64 before returning the data back to client. This should make the emojis work on the client applications.






                share|improve this answer

























                  up vote
                  2
                  down vote













                  Another option to try: Client needs to encode message in base 64 before sending to server and decode back to base 64 before returning the data back to client. This should make the emojis work on the client applications.






                  share|improve this answer























                    up vote
                    2
                    down vote










                    up vote
                    2
                    down vote









                    Another option to try: Client needs to encode message in base 64 before sending to server and decode back to base 64 before returning the data back to client. This should make the emojis work on the client applications.






                    share|improve this answer












                    Another option to try: Client needs to encode message in base 64 before sending to server and decode back to base 64 before returning the data back to client. This should make the emojis work on the client applications.







                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered Nov 29 at 20:32









                    Vimal Mathew

                    47538




                    47538






















                        up vote
                        1
                        down vote













                        You may have to refer the following article The ultimate guide to Emojis to get some insight in to how this can be handled.






                        share|improve this answer

























                          up vote
                          1
                          down vote













                          You may have to refer the following article The ultimate guide to Emojis to get some insight in to how this can be handled.






                          share|improve this answer























                            up vote
                            1
                            down vote










                            up vote
                            1
                            down vote









                            You may have to refer the following article The ultimate guide to Emojis to get some insight in to how this can be handled.






                            share|improve this answer












                            You may have to refer the following article The ultimate guide to Emojis to get some insight in to how this can be handled.







                            share|improve this answer












                            share|improve this answer



                            share|improve this answer










                            answered Nov 23 at 21:22









                            Vimal Mathew

                            47538




                            47538






























                                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.





                                Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                                Please pay close attention to the following guidance:


                                • 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%2f53393318%2fgetting-error-message-while-saving-emojis-with-text-data%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

                                Wiesbaden

                                Marschland

                                Dieringhausen