File tree Expand file tree Collapse file tree 2 files changed +10
-4
lines changed Expand file tree Collapse file tree 2 files changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -131,8 +131,11 @@ def viml_keys(obj):
131131 return obj .keys ()
132132
133133def viml_len (obj ):
134- if type (obj ) is str :
135- return len (obj .encode ('utf-8' ))
134+ try :
135+ if type (obj ) is str :
136+ return len (obj .encode ('utf-8' , 'ignore' ))
137+ except UnicodeDecodeError :
138+ pass
136139 return len (obj )
137140
138141def viml_printf (* args ):
Original file line number Diff line number Diff line change @@ -131,8 +131,11 @@ def viml_keys(obj):
131131 return obj .keys ()
132132
133133def viml_len (obj ):
134- if type (obj ) is str :
135- return len (obj .encode ('utf-8' ))
134+ try :
135+ if type (obj ) is str :
136+ return len (obj .encode ('utf-8' , 'ignore' ))
137+ except UnicodeDecodeError :
138+ pass
136139 return len (obj )
137140
138141def viml_printf (* args ):
You can’t perform that action at this time.
0 commit comments