You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@geode.apache.org by "Blake Bender (Jira)" <ji...@apache.org> on 2021/08/25 17:49:00 UTC
[jira] [Resolved] (GEODE-9412) App crashes when translating string
with certain Unicode characters (exception thrown across managed/native
boundary)
[ https://issues.apache.org/jira/browse/GEODE-9412?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Blake Bender resolved GEODE-9412.
---------------------------------
Resolution: Fixed
> App crashes when translating string with certain Unicode characters (exception thrown across managed/native boundary)
> ---------------------------------------------------------------------------------------------------------------------
>
> Key: GEODE-9412
> URL: https://issues.apache.org/jira/browse/GEODE-9412
> Project: Geode
> Issue Type: Bug
> Components: native client
> Reporter: Blake Bender
> Priority: Major
> Labels: pull-request-available
>
> tl;dr, we're not translating unicode correctly between .net and C++.
> When a unicode string comes into the CLI layer, we use `marshal_as<std::string>` to translate, then assume this yields UTF-8. In fact, what it yields is a string encoded in a) whatever the local code page is for the system, or b) the default code page for the app, if one exists in the manifest. In the C++ layer, we then assume the string is UTF-8, and for a PUT, attempt to translate into Java-modified UTF-8, which ends up throwing an uncaught exception when it encounters a character that is not a valid UTF-8 start code. When this exception hits the native/managed boundary, the app crashes.
> To avoid this issue, we need to `marshal_as<std::wstring>`, then use `std` conversion functions to arrive at UTF-8, and pass that down to the C++ layer. We also need to use the reverse process when sending strings back up to CLI.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)