WStringAutoPtr ParameterAsWideString ( const DataVect& parameters, FMX_UInt32 which )
{	
	
	WStringAutoPtr result ( new wstring );
	
	try {
		
		TextAutoPtr raw_data;
		raw_data->SetText ( parameters.AtAsText(which) );
		
		FMX_Int32 text_size = raw_data->GetSize();
		FMX_UInt16 * text = new FMX_UInt16 [ text_size + 1 ];
		raw_data->GetUnicode ( text, 0, text_size );
        text[text_size] = 0x0000;

		// wchar_t is 4 bytes on OS X and 2 on Windows
		
		#if defined(FMX_MAC_TARGET)
		
			wchar_t * parameter = new wchar_t [ text_size + 1 ];
			for ( long i = 0 ; i <= text_size ; i++ ) {
				parameter[i] = (wchar_t)text[i];
			}
			delete [] text;
		
		#endif 
		
		#if defined(FMX_WIN_TARGET)
		
			wchar_t * parameter = (wchar_t*)text;
		
		#endif
		
		result->append ( parameter );
		delete [] parameter; // parameter == text on Windows
				
	} catch ( exception& e ) {
		;	// return an empty string
	}
	
	return result;
	
} // ParameterAsUnicodeString
StringAutoPtr ParameterAsUTF8String ( const DataVect& parameters, FMX_UInt32 which )
{	
	
	StringAutoPtr result ( new string );
	
	try {
		
		TextAutoPtr raw_data;
		raw_data->SetText ( parameters.AtAsText ( which ) );
		
		FMX_UInt32 text_size = (2*(raw_data->GetSize())) + 1;
		char * text = new char [ text_size ]();
		raw_data->GetBytes ( text, text_size, 0, (FMX_UInt32)Text::kSize_End, Text::kEncoding_UTF8 );
		result->assign ( text );
		delete [] text;
		
	} catch ( exception& e ) {
		;	// return an empty string
	}
	
	return result;
	
} // ParameterAsUTF8String