XSIUtils.WriteUTF16TextFile

Introduced

v9.0 (2011)

Description

Writes the given string in a new text file. If the string contains non-ASCII characters, the file will be a windows unicode ("UTF-16") text file compatible with Window's notepad and Softimage's Script Editor. Otherwise, it will be a normal text file. This function is useful to write out text files that could contain japanese characters. XSIUtils.ReadTextFile can be used to read the file back.

C# Syntax

XSIUtils.WriteUTF16TextFile( String in_Path, String in_text );

Scripting Syntax

oReturn = XSIUtils.WriteUTF16TextFile( in_path, in_string );

Return Value

Returns True if the function succeeded

Parameters

Parameter Type Description
in_path String Path to the new text file.
in_string String New text of the file

Examples

JScript Example

var file_path = XSIUtils.BuildPath( XSIUtils.Environment("XSI_USERHOME"), "MyTextTestFile.txt" );
var test_text = "Hello, world!";
try
{
	XSIUtils.WriteUTF16TextFile( file_path, test_text );
	Application.LogMessage( XSIUtils.ReadTextFile( file_path ) );
}
catch (e) 
{
}

See Also

XSIUtils.ReadTextFile XSIUtils.Environment