Skip to content

Commit

Permalink
utf8 to utf16 conversion must use native endianness
Browse files Browse the repository at this point in the history
There is no obvious reason why native endianness should not be used, and
tests failed on big-endian architectures.
  • Loading branch information
tautschnig committed Jul 7, 2018
1 parent 8187bdd commit c6c1938
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion jbmc/src/java_bytecode/java_string_literals.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ symbol_exprt get_or_create_string_literal_symbol(
if(string_refinement_enabled)
{
const array_exprt data =
utf16_to_array(utf8_to_utf16_little_endian(id2string(value)));
utf16_to_array(utf8_to_utf16(id2string(value), false));

struct_exprt literal_init(new_symbol.type);
literal_init.operands().resize(jls_struct.components().size());
Expand Down
1 change: 1 addition & 0 deletions src/util/unicode.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ std::wstring widen(const std::string &s);

std::string utf32_to_utf8(const std::basic_string<unsigned int> &s);

std::wstring utf8_to_utf16(const std::string &in, bool swap_bytes);
std::wstring utf8_to_utf16_big_endian(const std::string &);
std::wstring utf8_to_utf16_little_endian(const std::string &);
std::string utf16_little_endian_to_java(const wchar_t ch);
Expand Down

0 comments on commit c6c1938

Please sign in to comment.