Re: Euphoria and Unicode

new topic     » goto parent     » topic index » view thread      » older message » newer message
DerekParnell said...

By "it basically treats them as UTF-16" do you mean Euphoria or wxEuphoria? I'm very certain that Euphoria does not treat them as utf-16. In which case, how does conversion from Euphoria text to UTF-16 occur?

wxEuphoria does. And it puts each 'wide' character in a single euphoria integer as an element of a sequence. Here is the C++ code that converts a sequence to a wxString. It actually works for both the unicode and the ANSI version of wxWidgets:

wxString get_string( object seq ) 
{ 
	wxChar * str; 
	 
	if( !IS_SEQUENCE(seq) )  
		RTFatal("expected a sequence"); 
	s1_ptr s1 = SEQ_PTR(seq); 
	int len = s1->length; 
	str = new wxChar[len+1]; 
	for( int i = 1; i <= s1->length; i++ ){ 
		object x = s1->base[i]; 
		if( IS_SEQUENCE( x ) ) return wxEmptyString; 
		if( !IS_ATOM_INT( x ) ) 
			x = (long) DBL_PTR(x)->dbl; 
		str[i-1] = (wxChar) x; 
		 
	} 
	str[len] = 0; 
	wxString s( str ); 
	delete[] str; 
	return s; 
} 

Matt

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu