function encode_utf8(rohtext)
{
	// dient der Normalisierung des Zeilenumbruchs
	rohtext = rohtext.replace(/\r\n/g,'\n');
	var utftext = '';
	for(var n=0; n<rohtext.length; n++)
	{
		// ermitteln des Unicodes des  aktuellen Zeichens
		var c=rohtext.charCodeAt(n);
		
		if (c<128) // alle Zeichen von 0-127 => 1byte
			utftext += String.fromCharCode(c);
		else if((c>127) && (c<2048)) // alle Zeichen von 127 bis 2047 => 2byte
		{
			utftext += String.fromCharCode((c>>6)|192);
			utftext += String.fromCharCode((c&63)|128);
		}
		else // alle Zeichen von 2048 bis 66536 => 3byte
		{
			utftext += String.fromCharCode((c>>12)|224);
			utftext += String.fromCharCode(((c>>6)&63)|128);
			utftext += String.fromCharCode((c&63)|128);
		}
	}
	return utftext;
}