Special characters Webservice C# SQL X Base Firebird

Asked

Viewed 216 times

0

I have an integration made by Web-service (asmx) , C# e SQL Server. This Web-Service is consumed by a third-party software that uses Delphi and Firebird.

The problem is that when integrating a string field that has special characters, questions (??) are appearing instead of characters.

For example, the Delphi program sends a customer registration with the name John , when you arrive at the web-service is Jo?? o.

Is there anything I can do on the web-service to avoid this problem? or should the treatment be done on the client’s side? And what should be done?

I tried to include a globalization to resolve the situation, it did not work:

<globalization
 requestEncoding="iso-8859-1"
 responseEncoding="iso-8859-1"
 responseHeaderEncoding="iso-8859-1"
 fileEncoding="iso-8859-1"
 resourceProviderFactoryType=""
 enableBestFitResponseEncoding="true"/>

Example of the Webmethod:

[WebMethod]
    public MessageRet IntegrarItemInsumo(ItemInsumo Object)
    {
        try
        {
            return Object.Add();
        }
        catch (Exception)
        {

            throw;
        }
    }
  • What is the web-service charset? post how you are receiving the data and the method you receive it.

  • It was with UFT-8 , after reading some post I include globalization in config, but it did not help. <globalization requestEncoding="iso-8859-1" responseEncoding="iso-8859-1" responseHeaderEncoding="iso-8859-1" fileEncoding="iso-8859-1" resourceProviderFactoryType="" sponenableBestFitReseEncoding=true""/>

  • Edit your question and post as you do when receiving the dice.

  • 1

    user3410955, I believe your client is not informing you ContentType appropriate, try to force the HttpContext.Current.Request.ContentType for text/xml; charset=UTF-8 before deserialiation occurs.

  • @Tobymosque , when you say client would be on the side of Delphi software and not webservice C# ?

  • @Briansouza, yes, client is the Delphi application that consumes your Webservice, however you can try to change this header in your application.

  • @Tobymosque , how ? would have some link to instruct me ?

Show 2 more comments

1 answer

1

Brian, I believe the Customer written in Delphi who consumes your Webservice is sending the ContentType incorrect, in this case you can contact your customer and ask to use the text/xml; charset=iso-8859-1.

Or you can make one arranjo técnico provisório and modify the ContentType of all the requests in your Global.asax:

protected void Application_BeginRequest(object sender, EventArgs e)
{
    HttpContext.Current.Request.ContentType = "text/xml; charset=iso-8859-1";
}

if it also does not work with iso-8859-1, try the UTF-8

Browser other questions tagged

You are not signed in. Login or sign up in order to post.