projects
/
supertux.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
aa3d84d
)
Malformed UTF-8 sequences are no longer fatal
author
Christoph Sommer
<mail@christoph-sommer.de>
Fri, 30 Jun 2006 15:31:02 +0000
(15:31 +0000)
committer
Christoph Sommer
<mail@christoph-sommer.de>
Fri, 30 Jun 2006 15:31:02 +0000
(15:31 +0000)
SVN-Revision: 3811
src/video/font.cpp
patch
|
blob
|
history
diff --git
a/src/video/font.cpp
b/src/video/font.cpp
index
42aa455
..
2a41b2a
100644
(file)
--- a/
src/video/font.cpp
+++ b/
src/video/font.cpp
@@
-223,7
+223,15
@@
Font::draw_chars(Surface* pchars, const std::string& text, const Vector& pos,
Vector p = pos;
size_t i = 0;
while(i < text.size()) {
- uint32_t c = decode_utf8(text, i);
+ uint32_t c;
+ try {
+ c = decode_utf8(text, i);
+ }
+ catch (std::runtime_error) {
+ log_debug << "Malformed utf-8 sequence beginning with " << *((uint32_t*)(text.c_str() + i)) << " found " << std::endl;
+ c = 0;
+ i++;
+ }
ssize_t font_index;
// a non-printable character?