diff options
author | Campbell Barton <ideasman42@gmail.com> | 2010-08-28 16:34:22 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2010-08-28 16:34:22 +0400 |
commit | f28b5e672ed05bb08b317c78a36b31e7c49d4f4e (patch) | |
tree | e326ad5f429f01c63878989d4ca393aa9bc65051 /source/blender/blenlib/BLI_string.h | |
parent | 7a7076c878f7f5f5a28653a9a0df76065948ea7a (diff) |
python/utf8 compatibility fixes. (as discussed on the mailing list)
- user input gets non utf8 chars stripped all text input other then file paths.
- python has the same limitations, it will raise an error on non utf8 strings except for paths use unicode escape literals so its possible to deal with saving to these file paths from python.
- new string functions
BLI_utf8_invalid_byte(str, len) returns the first invalid utf8 byte or -1 on on success.
BLI_utf8_invalid_strip(str, len) strips non utf-8 chars.
Diffstat (limited to 'source/blender/blenlib/BLI_string.h')
-rw-r--r-- | source/blender/blenlib/BLI_string.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/source/blender/blenlib/BLI_string.h b/source/blender/blenlib/BLI_string.h index 39123a438df..ccb10190816 100644 --- a/source/blender/blenlib/BLI_string.h +++ b/source/blender/blenlib/BLI_string.h @@ -132,6 +132,9 @@ size_t BLI_strnlen(const char *str, size_t maxlen); void BLI_timestr(double _time, char *str); /* time var is global */ +int BLI_utf8_invalid_byte(const char *str, int length); +int BLI_utf8_invalid_strip(char *str, int length); + #ifdef __cplusplus } #endif |