projects
/
platform
/
core
/
uifw
/
dali-toolkit.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge "Fix resource package install issue." into devel/master
[platform/core/uifw/dali-toolkit.git]
/
dali-toolkit
/
internal
/
text
/
character-set-conversion.cpp
diff --git
a/dali-toolkit/internal/text/character-set-conversion.cpp
b/dali-toolkit/internal/text/character-set-conversion.cpp
index
67c294b
..
d79fbc3
100644
(file)
--- a/
dali-toolkit/internal/text/character-set-conversion.cpp
+++ b/
dali-toolkit/internal/text/character-set-conversion.cpp
@@
-69,8
+69,16
@@
namespace
U0, U0, U0, U0, // Non valid.
U0, U0, U0, U0, // Non valid.
};
U0, U0, U0, U0, // Non valid.
U0, U0, U0, U0, // Non valid.
};
+
+ const uint8_t CR = 0xd;
+ const uint8_t LF = 0xa;
} // namespace
} // namespace
+uint8_t GetUtf8Length( uint8_t utf8LeadByte )
+{
+ return UTF8_LENGTH[utf8LeadByte];
+}
+
uint32_t GetNumberOfUtf8Characters( const uint8_t* const utf8, uint32_t length )
{
uint32_t numberOfCharacters = 0u;
uint32_t GetNumberOfUtf8Characters( const uint8_t* const utf8, uint32_t length )
{
uint32_t numberOfCharacters = 0u;
@@
-130,8
+138,26
@@
uint32_t Utf8ToUtf32( const uint8_t* const utf8, uint32_t length, uint32_t* utf3
{
case U1:
{
{
case U1:
{
- *utf32++ = leadByte;
- begin++;
+ if( CR == leadByte )
+ {
+ // Replace CR+LF or CR by LF
+ *utf32++ = LF;
+
+ // Look ahead if the next one is a LF.
+ ++begin;
+ if( begin < end )
+ {
+ if( LF == *begin )
+ {
+ ++begin;
+ }
+ }
+ }
+ else
+ {
+ *utf32++ = leadByte;
+ begin++;
+ }
break;
}
break;
}
@@
-170,6
+196,13
@@
uint32_t Utf8ToUtf32( const uint8_t* const utf8, uint32_t length, uint32_t* utf3
code |= *begin++ & 0x3fu;
break;
}
code |= *begin++ & 0x3fu;
break;
}
+
+ case U0: // Invalid case
+ {
+ begin++;
+ *utf32++ = 0x20; // Use white space
+ break;
+ }
}
}
}
}