@@ -83,12 +83,15 @@ write_string(garray_T *gap, char_u *str)
8383 vimconv_T conv ;
8484 char_u * converted = NULL ;
8585
86- convert_setup (& conv , p_enc , (char_u * )"utf-8" );
87- if (conv .vc_type != CONV_NONE )
88- converted = res = string_convert (& conv , res , NULL );
89- convert_setup (& conv , NULL , NULL );
86+ if (!enc_utf8 )
87+ {
88+ conv .vc_type = CONV_NONE ;
89+ convert_setup (& conv , p_enc , (char_u * )"utf-8" );
90+ if (conv .vc_type != CONV_NONE )
91+ converted = res = string_convert (& conv , res , NULL );
92+ convert_setup (& conv , NULL , NULL );
93+ }
9094#endif
91-
9295 ga_append (gap , '"' );
9396 while (* res != NUL )
9497 {
@@ -540,10 +543,14 @@ json_decode_string(js_read_T *reader, typval_T *res)
540543
541544 p = reader -> js_buf + reader -> js_used + 1 ; /* skip over " */
542545#if defined(FEAT_MBYTE ) && defined(USE_ICONV )
543- convert_setup (& conv , (char_u * )"utf-8" , p_enc );
544- if (conv .vc_type != CONV_NONE )
545- converted = p = string_convert (& conv , p , NULL );
546- convert_setup (& conv , NULL , NULL );
546+ if (!enc_utf8 )
547+ {
548+ conv .vc_type = CONV_NONE ;
549+ convert_setup (& conv , (char_u * )"utf-8" , p_enc );
550+ if (conv .vc_type != CONV_NONE )
551+ converted = p = string_convert (& conv , p , NULL );
552+ convert_setup (& conv , NULL , NULL );
553+ }
547554#endif
548555 while (* p != '"' )
549556 {
0 commit comments