cwmiller/broadworks-connector-net

Encoding issue

Closed this issue · 1 comments

Rogn commented

Hi,

We are experiencing a problem with handling special Faroese characters as ó and ð
Seems like our responses are ISO-8859-1 encoded, but the code always uses UTF8 to decode the responses.

I have currently resolved it by extending the OcipClientOptions class with a TcpResponseEncoding and TcpRequestEncoding

        /// <summary>
        /// Encoding setting for encoding the request data with TCP transport. Defaults to UTF8.
        /// </summary>
        public Encoding TcpRequestEncoding { get; set; } = Encoding.UTF8;

        /// <summary>
        /// Encoding setting for decoding the request data with TCP transport. Defaults to UTF8.
        /// </summary>
        public Encoding TcpResponseEncoding { get; set; } = Encoding.UTF8;

These options are then used in the TcpTransport class.

If you agree with the solution, I would be happy to create a pull request

/Hallur

Thanks for reporting this. I'd be glad to take a pull request.