fix malformed utf-8: writeBytes just strips all but the last byte of multi-byte utf8 chars!

This commit is contained in:
Eric House 2014-04-17 07:42:34 -07:00
parent 73a1083dff
commit 56ce5761d7

View file

@ -696,6 +696,7 @@ public class RelayService extends XWService
out.writeShort( BuildConstants.CLIENT_VERS_RELAY );
writeVLIString( out, BuildConstants.GIT_REV );
// writeVLIString( out, String.format( "€%s", Build.MODEL) );
writeVLIString( out, Build.MODEL );
writeVLIString( out, Build.VERSION.RELEASE );
@ -1152,9 +1153,10 @@ public class RelayService extends XWService
if ( null == str ) {
str = "";
}
int len = str.length();
byte[] bytes = str.getBytes( "UTF-8" );
int len = bytes.length;
un2vli( len, os );
os.writeBytes( str );
os.write( bytes, 0, len );
}
private void setMaxIntervalSeconds( int maxIntervalSeconds )