Getting Error Message While Saving Emojis With Text Data












2















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 '18 at 12:48
















2















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 '18 at 12:48














2












2








2








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 '18 at 10:57







K.Sumith

















asked Nov 20 '18 at 12:46









K.SumithK.Sumith

68110




68110













  • use a different character set

    – Stultuske
    Nov 20 '18 at 12:48



















  • use a different character set

    – Stultuske
    Nov 20 '18 at 12:48

















use a different character set

– Stultuske
Nov 20 '18 at 12:48





use a different character set

– Stultuske
Nov 20 '18 at 12:48












3 Answers
3






active

oldest

votes


















1














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































    2














    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































      1














      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',
        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%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









        1














        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




























          1














          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


























            1












            1








            1







            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 '18 at 11:05









            Sreejith SreeSreejith Sree

            391212




            391212

























                2














                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




























                  2














                  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


























                    2












                    2








                    2







                    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 '18 at 20:32









                    Vimal MathewVimal Mathew

                    47538




                    47538























                        1














                        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




























                          1














                          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


























                            1












                            1








                            1







                            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 '18 at 21:22









                            Vimal MathewVimal 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.




                                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

                                MongoDB - Not Authorized To Execute Command

                                in spring boot 2.1 many test slices are not allowed anymore due to multiple @BootstrapWith

                                How to fix TextFormField cause rebuild widget in Flutter