patch 9.1.1144: no way to create raw strings from a blob
Problem: no way to create raw strings from a blob
Solution: support the "encoding": "none" option
to create raw strings (which may be invalid!)
(Bakudankun)
closes: #16666
Signed-off-by: Bakudankun <bakudankun@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
diff --git a/src/testdir/test_functions.vim b/src/testdir/test_functions.vim
index 8ecc3a6..6928cda 100644
--- a/src/testdir/test_functions.vim
+++ b/src/testdir/test_functions.vim
@@ -4446,6 +4446,9 @@
call assert_equal(['a'], blob2str(0z61, test_null_dict()))
call assert_equal(['a'], blob2str(0z61, {'encoding': test_null_string()}))
+ call assert_equal(["\x80"], blob2str(0z80, {'encoding': 'none'}))
+ call assert_equal(['a', "\x80"], blob2str(0z610A80, {'encoding': 'none'}))
+
#" Invalid encoding
call assert_fails("call blob2str(0z80)", "E1515: Unable to convert from 'utf-8' encoding")
call assert_fails("call blob2str(0z610A80)", "E1515: Unable to convert from 'utf-8' encoding")