# Write to Text File - ANSI only?

**URL:** https://www.finalbuilder.com/forums/t/write-to-text-file-ansi-only/3347
**Category:** Bugs
**Created:** [April 5, 2011, 10:15am UTC](https://www.finalbuilder.com/forums/t/write-to-text-file-ansi-only/3347 "2011-04-05T10:15:30Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![deleted\_user](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/deleted_user/32/937_2.png) [@deleted\_user](https://www.finalbuilder.com/forums/u/deleted_user)
#### Post date: [April 5, 2011, 10:15am UTC](https://www.finalbuilder.com/forums/t/write-to-text-file-ansi-only/3347/1 "2011-04-05T10:15:30Z")

</div>

Hi all,

There seem to be a problem with the 'Write to Text File' action when it need to write data into unicode files.  
I've attached my unicode text file named 'unicode.txt' with encoding 'UCS-2 Little Endian' as test subject so you can easily reproduce the problem.

My guess is that the action can only write in ANSI mode and not in unicode, or the action could not determinate the correct encoding format.

[unicode.txt](https://www.finalbuilder.com/forums/uploads/default/original/2X/b/bae81caa029ee1644e089eccc85f71ad94a788d4.txt) (170 B)

---

<div class="post-metadata">

### Author: ![Vincent](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/vincent/32/938_2.png) [@Vincent](https://www.finalbuilder.com/forums/u/Vincent)
#### Post date: [April 5, 2011, 1:03am UTC](https://www.finalbuilder.com/forums/t/write-to-text-file-ansi-only/3347/2 "2011-04-05T01:03:00Z")

</div>

This is a limitation of FinalBuilder 6( and earlier versions), it has only limited unicode support(only in some actions where critical). FinalBuilder 7 has full support for Unicode and the “Write to Text File” action allows you to specify the Encoding (UCS-2 Little Endian is the same as UTF16). I was able to use the action to append to your file with no problems.

---

<div class="post-metadata">

### Author: ![deleted\_user](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/deleted_user/32/937_2.png) [@deleted\_user](https://www.finalbuilder.com/forums/u/deleted_user)
#### Post date: [April 6, 2011, 11:01am UTC](https://www.finalbuilder.com/forums/t/write-to-text-file-ansi-only/3347/3 "2011-04-06T11:01:06Z")

</div>

Thx for the explanation, but i managed to bypass the Write and concatenation actions by using Powershell actions.   
 I have just one little question about using powershell in FB, how can i substitute variables in a string ?   
 In VbScript it was ‘Action.ExpandExpression’ but in PowerShell ?

---

<div class="post-metadata">

### Author: ![stephen.ryan](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/s/f14d63/32.png) [@stephen.ryan](https://www.finalbuilder.com/forums/u/stephen.ryan)
#### Post date: [April 19, 2011, 2:17am UTC](https://www.finalbuilder.com/forums/t/write-to-text-file-ansi-only/3347/4 "2011-04-19T02:17:52Z")

</div>

To expand variable references within a string you can use $Action.ExpandExpression(“string to expand”)   
  
 Regards,   
 Steve
