|
UTF8 - Simple Library for Internationalization
|
Exception thrown on encoding/decoding failure. More...
#include <utf8.h>
Public Types | |
| enum | cause { invalid_utf8 =1 , invalid_wchar , invalid_char32 } |
| Possible causes. | |
Public Member Functions | |
| exception (cause c) | |
| Constructor. | |
| const char * | what () const noexcept |
| Exception message. | |
Data Fields | |
| cause | code |
| Condition that triggered the exception. | |
Exception thrown on encoding/decoding failure.
Most UTF8 functions will throw an exception if input string is not a valid encoding.
So far there are two possible causes:
invalid_utf8 if the string is not a valid UTF-8 encodinginvalid_char32 if the string is not a valid UTF-32 codepoint.You can handle a utf8::exception using code like this:
or you can simply use the exception message: