[ 
https://issues.apache.org/jira/browse/GEODE-9412?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Blake Bender closed GEODE-9412.
-------------------------------

> 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)

Reply via email to