---
url: >-
  /statelake/scripting-reference/functions-and-procedures/file-functions/savewidestringtofile.md
---

# SaveWideStringToFile

**SaveWideStringToFile** saves the string given by **aContents** as a file on disk named as specified by **aFileName**.

This procedure is similar to **SaveToFile**, except that **SaveWideStringToFile** handles unicode characters., whereas **SaveToFile** does not. Please also see [SaveToFile](/statelake/scripting-reference/functions-and-procedures/file-functions/savetofile).

If a file with **aFileName** already exists, then it will be overwritten - if attributes and permissions allow. If permissions and attributes do not allow it to be overwritten, then an exception error will be encountered.

**Declaration**: Procedure SaveWideStringToFile(const aContents : string; const aFileName : string)

An example to save a simple file that contains unicode characters.

```pascal
procedure OnMapEvent(var Value:Variant);
 var vData : string;
begin
  vData := 'AaBbÖP€CcDd';
  SaveWideStringToFile(vData, 'c:\Temp\TodayTestWS.txt');
end;
```
