5 Replies Latest reply on Aug 10, 2016 9:41 AM by manpreets

    Special characters in doc titles with API 3.3

    dfiel

      When creating/updating a doc with API 3.3, I am unable to send special characters correctly for the document subject/title.

       

      If I don't encode them, they are messed up in the UI:

      Agiliance® RiskVision™

      becomes

      Agiliance® RiskVision™

       

      If I HTML encode them, they are not decoded:

      Agiliance® RiskVision™

      https://communities.bmc.com/docs/DOC-19540

       

      This is working OK in the body of the document.  I html encode the special characters and they are decoded in SBS 6 correctly.  This was also working with SBS 4.5 with API 1.x.  I did not encode the subject and it rendered correctly.

        • Re: Special characters in doc titles with API 3.3
          NathanielElliott

          Off topic question but... Do you all work with Agiliance® RiskVision™ and gone through that process? If so, would you be willing to share a few lessons learned?

          • Re: Special characters in doc titles with API 3.3
            Ryan Rutan

            Could you send me a testable curl statement that you are using?  I would also instead of trying HTML encoding, perhaps trying to set the "Content-Type" header to something like:

            Content-Type: text/html; charset=utf-8

            Could you try that and let me know if that helps, or provide a testable curl statement?

            • Re: Special characters in doc titles with API 3.3
              manpreets

              Hi Ryan Rutan,

               

              I am still having the same issue with new jive rest api (3.14). I am trying to insert the following data:

              {

                "type": "document",

                "visibility": "place",

                "parent": "https://xyz.com/api/core/v3/places/1234",

                "content": {

                  "type": "text/html; charset=utf-8",

                  "text": "<body><div style=\"font-weight: bold; font-size: 125%; width: 100%; border-bottom: solid 2px #222; margin: 10px 0px; padding-bottom: 3px;\">How_to</div><div><div class=\"hello\">To change your password, enter your current password and the new one you’d like to switch to.</div> <br></body>"

                },

                "subject": "lnl-profile",

                "tags": [

                  "abc",

                  "def",

                  "ghit"

                ]

              }

              but it will respond with error:

               

              "error" : {

              "message" : "Unterminated string at character "

              }

               

              We have figured it out, because it contains "you’d" (special character) in our document body.

               

              Any suggestion would be helpful.

               

              Thanks

                • Re: Special characters in doc titles with API 3.3
                  Ryan Rutan

                  Can you confirm that your string is indeed UTF8?  That is how the server will try to read the bytes, that eventually get interpreted as properly formatted JSON.  If the charset does not match the content type declared in the request header...then the system cannot read it correct.  Can you confirm you are sending "Content-Type" : "application/json; charset=utf-8" as the request header? (note: not the content.type body parameter)

                    • Re: Special characters in doc titles with API 3.3
                      manpreets

                      Hi Ryan Rutan,

                       

                      This time, I did a post call with the following:

                       

                      {

                        "Content-Type": "application/json; charset=utf-8",

                        "type": "document",

                        "visibility": "place",

                        "parent": "https://community.abc.com/api/core/v3/places/1234",

                        "content": {

                          "type": "text/html",

                          "text": "<body><div style=\"font-weight: bold; font-size: 125%; width: 100%; border-bottom: solid 2px #222; margin: 10px 0px; padding-bottom: 3px;\">How_to</div><div><div class=\"hello\"> To change your password, enter your current password and the new one youd£ like to switch to. </div> <br></body>"

                        },

                        "subject": "lnl-profile",

                        "tags": [

                          "abc",

                          "def",

                          "ghi"

                        ]

                      }

                       

                      In the above json I have used

                      £pound sign

                      which is valid utf-8 character.

                      but when I removed the pound sign then It had published successfully.

                       

                      Thanks