<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Create txt file with encoding of ANSI in Product Forum</title>
    <link>https://community.blueprism.com/t5/Product-Forum/Create-txt-file-with-encoding-of-ANSI/m-p/100305#M47645</link>
    <description>Our current process is create a txt file, and then write into data save as a XML file. Target application read this xml file for further process.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I am using codes to create a txt file, the file is defaulted to UTF-8, in fact I have no idea why it is defaulted to that. below is my codes.&lt;BR /&gt;&lt;BR /&gt;&lt;EM&gt;Try&lt;/EM&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;EM&gt;Dim sw As StreamWriter&lt;/EM&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;EM&gt;If File.Exists(File_Name) = False Then&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;sw = File.CreateText(File_Name)&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;End If&lt;/EM&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;EM&gt;Success = True&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;Message = ""&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;Catch e As Exception&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;Success = False&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;Message = e.Message&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;End Try&lt;/EM&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;But recently the target application get upgraded, the acceptable encoding is ANSI instead of UTF-8 any more, else Chinese characters will be not recognized.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I am thinking to create a txt object to change the encoding, but it looks inefficient. I want to know how to create the txt file with ANSI encoding based on my codes.</description>
    <pubDate>Mon, 12 Jul 2021 09:45:06 GMT</pubDate>
    <dc:creator>EricLi</dc:creator>
    <dc:date>2021-07-12T09:45:06Z</dc:date>
    <item>
      <title>Create txt file with encoding of ANSI</title>
      <link>https://community.blueprism.com/t5/Product-Forum/Create-txt-file-with-encoding-of-ANSI/m-p/100305#M47645</link>
      <description>Our current process is create a txt file, and then write into data save as a XML file. Target application read this xml file for further process.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I am using codes to create a txt file, the file is defaulted to UTF-8, in fact I have no idea why it is defaulted to that. below is my codes.&lt;BR /&gt;&lt;BR /&gt;&lt;EM&gt;Try&lt;/EM&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;EM&gt;Dim sw As StreamWriter&lt;/EM&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;EM&gt;If File.Exists(File_Name) = False Then&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;sw = File.CreateText(File_Name)&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;End If&lt;/EM&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;EM&gt;Success = True&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;Message = ""&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;Catch e As Exception&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;Success = False&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;Message = e.Message&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;End Try&lt;/EM&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;But recently the target application get upgraded, the acceptable encoding is ANSI instead of UTF-8 any more, else Chinese characters will be not recognized.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I am thinking to create a txt object to change the encoding, but it looks inefficient. I want to know how to create the txt file with ANSI encoding based on my codes.</description>
      <pubDate>Mon, 12 Jul 2021 09:45:06 GMT</pubDate>
      <guid>https://community.blueprism.com/t5/Product-Forum/Create-txt-file-with-encoding-of-ANSI/m-p/100305#M47645</guid>
      <dc:creator>EricLi</dc:creator>
      <dc:date>2021-07-12T09:45:06Z</dc:date>
    </item>
    <item>
      <title>Re: Create txt file with encoding of ANSI</title>
      <link>https://community.blueprism.com/t5/Product-Forum/Create-txt-file-with-encoding-of-ANSI/m-p/100306#M47646</link>
      <description>Unicode, and UTF-8, is the default within .NET. If you want ASCII, you’ll need to specifying that on your StreamWriter using the &lt;STRONG&gt;Encoding&amp;nbsp;&lt;/STRONG&gt;interface.&lt;BR /&gt;&lt;BR /&gt;See this article for some examples:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://www.arclab.com/en/kb/csharp/read-write-text-file-ansi-utf8-unicode.html" target="_blank" rel="noopener"&gt;https://www.arclab.com/en/kb/csharp/read-write-text-file-ansi-utf8-unicode.html&lt;/A&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 12 Jul 2021 11:14:39 GMT</pubDate>
      <guid>https://community.blueprism.com/t5/Product-Forum/Create-txt-file-with-encoding-of-ANSI/m-p/100306#M47646</guid>
      <dc:creator>ewilson</dc:creator>
      <dc:date>2021-07-12T11:14:39Z</dc:date>
    </item>
    <item>
      <title>Re: Create txt file with encoding of ANSI</title>
      <link>https://community.blueprism.com/t5/Product-Forum/Create-txt-file-with-encoding-of-ANSI/m-p/100307#M47647</link>
      <description>Thank you, Eric Wilson. It works in my process.</description>
      <pubDate>Wed, 14 Jul 2021 03:39:18 GMT</pubDate>
      <guid>https://community.blueprism.com/t5/Product-Forum/Create-txt-file-with-encoding-of-ANSI/m-p/100307#M47647</guid>
      <dc:creator>EricLi</dc:creator>
      <dc:date>2021-07-14T03:39:18Z</dc:date>
    </item>
  </channel>
</rss>

