Go Back

Changing the character encoding for xfNetLink .NET

Article Number: 2496
First Published:
Modified:
Recent Activity:
Views: 81
OS: Windows
Product: xfServerPlus, xfNetLink .NET

By default, xfNetLink .NET uses the ISO-8859-1 character set to encode/decode characters when sending data from .NET to Synergy.


This works fine for most customers, but ISO-8859-1 does not define characters for values in the range 128-159. If you need characters in this range, such as the Euro symbol (€) at 128, you can change the encoding used by xfNetLink .NET to Windows-1252 in the application configuration file (aka, config file). You must do this manually, as the encoding option is not available in the xfNetLink .NET Configuration utility.


(If you are not using a config file, you can use the XFNLNET_CLASS_ENCODING setting to specify the default character set.)


To change encoding, use a text editor to add the bolded line to your config file:


<?xml version="1.0" encoding="utf-8"?>

<configuration>

 <configSections>

   <sectionGroup name="xfnlnet">

     <section name="default" type="System.Configuration.NameValueSectionHandler, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />

   </sectionGroup>

 </configSections>

 <startup>

   <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />

 </startup>

 <xfnlnet>

   <default>

     <add key="encoding" value="Windows-1252" />

   </default>

 </xfnlnet>

</configuration>


Any of the encodings listed in the "List of encodings" table in https://docs.microsoft.com/en-us/dotnet/api/system.text.encoding are valid. Just put the encoding name in quotes as shown above.


For additional information on ISO-8859-1 and Windows-1252, see https://www.w3schools.com/charsets/ref_html_8859.asp.



THE INFORMATION PROVIDED TO YOU IN THIS SERVICE IS FOR YOUR USE ONLY. THE INFORMATION MAY HAVE BEEN DEVELOPED INTERNALLY BY SYNERGEX OR BY EXTERNAL SOURCES. SYNERGEX MAKES NO WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS INFORMATION, INCLUDING THE WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SYNERGEX BE LIABLE FOR ANY DAMAGES OR LOSSES INCURRED BY YOU IN USING OR RELYING ON THIS INFORMATION, INCLUDING WITHOUT LIMITATION GENERAL DAMAGES, DIRECT, INCIDENTAL, SPECIAL OR CONSEQUENTIAL DAMAGES, OR LOSS OF PROFITS, EVEN IF SYNERGEX HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
Please log in to comment on this article.