function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
DemintDemint 

Apex Callout error: Unsupported encoding: "utf-8", but works in Eclipse exec anon

Happy (nearly) New year!   Please can you help as am stumped on this one...

I am getting inconsistent behaviour between Eclipse and Salesforce when executing a web service callout.

I have hand coded the callout with a HTTP Request (rather than use WSDL2Apex).  The callout works perfectly in Eclispe execute anonymous but fails in the Salesforce app with error:

  Unsupported encoding: "utf-8"

It also works fine from a standalone SOAP generator like SOAP UI.  Could it be related to the user I am running it as in SF?  Or could it be the encoding genuinely is not supported (I think it is since I have consumed other web services with UTF-8 before from the same org)

I know that most orgs by default having encoding set to UTF-8 ( the documentation says: "If your organization logs into ssl.salesforce.com, then your encoding is ISO-8859-1. All other instances use UTF-8. " - I am logging on to a developer account which is not ssl.salesforce.com).

 However I do not know how to check this setting from within Salesforce (without writing some external Java or C++ and using describeGlobal()


Does anyone have any suggestions on how to get to the bottom of what this error is? Or how to check my org encoding setting from within Salesforce?

The web service is running on Glassfish if that helps at all (although I have limited knowledge / access to it).

Thanks in advance,

Demi

 

 

corbinovcorbinov

So nobody else has had this issue?  I have this exact same problem. I have a hand-coded HTTPRequest to a SOAP webservice and I get the error "Unsupported encoding:  "utf-8".

I have made several manual callouts to other webservices with no problem from apex, but for some reason I cannot resolve this error.

 

Any help, anyone?

 

torctorc
I'm having the same issue.

After doing some google searching, it looks like the Web-to-lead generator in Salesforce displays the encoding. I generated a quick web-to-lead form, and it seems like my org is UTF-8. Here's the line in the form: <form action="https://www.salesforce.com/servlet/servlet.WebToLead?encoding=UTF-8" method="POST">

I don't have access to an org that logs in to ssl.salesforce.com, so I can't confirm this for sure. But I'm assuming that I'm UTF-8 for now since that's what Salesforce is generating in the form.