@@ -611,22 +611,29 @@ private void appendSQLTimestamp(final Timestamp value) {
611611	}
612612
613613	private  void  appendString (final  String  value ) throws  VPackBuilderException  {
614- 		final  int  length  = value .getBytes ().length ;
615- 		if  (length  <= 126 ) {
616- 			// short string 
617- 			add ((byte ) (0x40  + length ));
618- 		} else  {
619- 			// long string 
620- 			add ((byte ) 0xbf );
621- 			appendLength (length );
622- 		}
623614		try  {
624- 			append (value );
615+ 			final  byte [] bytes  = value .getBytes ("UTF-8" );
616+ 			final  int  length  = bytes .length ;
617+ 			if  (length  <= 126 ) {
618+ 				// short string 
619+ 				add ((byte ) (0x40  + length ));
620+ 			} else  {
621+ 				// long string 
622+ 				add ((byte ) 0xbf );
623+ 				appendLength (length );
624+ 			}
625+ 			appendString (bytes );
625626		} catch  (final  UnsupportedEncodingException  e ) {
626627			throw  new  VPackBuilderException (e );
627628		}
628629	}
629630
631+ 	private  void  appendString (final  byte [] bytes ) {
632+ 		ensureCapacity (size  + bytes .length );
633+ 		System .arraycopy (bytes , 0 , buffer , size , bytes .length );
634+ 		size  += bytes .length ;
635+ 	}
636+ 
630637	private  void  appendBinary (final  byte [] value ) {
631638		add ((byte ) 0xc3 );
632639		append (value .length , INTEGER_BYTES );
@@ -642,13 +649,6 @@ private void appendVPack(final VPackSlice value) {
642649		size  += vpack .length ;
643650	}
644651
645- 	private  void  append (final  String  value ) throws  UnsupportedEncodingException  {
646- 		final  byte [] bytes  = value .getBytes ("UTF-8" );
647- 		ensureCapacity (size  + bytes .length );
648- 		System .arraycopy (bytes , 0 , buffer , size , bytes .length );
649- 		size  += bytes .length ;
650- 	}
651- 
652652	private  void  addArray (final  boolean  unindexed ) {
653653		addCompoundValue ((byte ) (unindexed  ? 0x13  : 0x06 ));
654654	}
0 commit comments