os.SaveString encoding?

Monkey Forums/Monkey Programming/os.SaveString encoding?

ziggy(Posted 2012) [#1]
Does anyone what is the text encoding used to save strings on the os.SaveString function on the cpp target?


DruggedBunny(Posted 2012) [#2]
I think it's UTF-8, as this (from lang.cpp -> String) checks whether or not a character within the string is > 254, then considers it Unicode (presumably treating it as ASCII otherwise):

	void Save( std::vector<unsigned char> &buf ){
	
		bool uni=false;
		
		for( int i=0;i<rep->length;++i ){
			if( rep->data[i]>=0xfe ){
				uni=true;
				break;
			}
		}

		if( uni ){
			...
		}else{
			...
		}


... and one of the Load methods checks for a Byte-Order Mark. (And also contains the comment "//Illegal UTF8!".)


ziggy(Posted 2012) [#3]
Aaah ok, so it detects appropriate encodins as in BlitzMax. Great. Thanks!