Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement Unicode support for RL.Net #59

Merged
merged 9 commits into from Apr 3, 2019

Conversation

lokitoth
Copy link
Member

@lokitoth lokitoth commented Apr 1, 2019

When we first built the .Net bindings for rlclientlib we make a decision to only support ASCII. (VowpalWabbit/vowpal_wabbit#1601). This will behave incorrectly when sending text with code points outside of ASCII.

This change implements proper marshalling using UTF8.

@@ -65,6 +65,11 @@ API int LiveModelInit(livemodel_context_t* context, reinforcement_learning::api_

API int LiveModelChooseRank(livemodel_context_t* context, const char * event_id, const char * context_json, reinforcement_learning::ranking_response* resp, reinforcement_learning::api_status* status)
{
if (event_id == nullptr)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This check looks unnecessary

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, good catch. Under the check, it was chaining to the wrong method in the nullptr case. It is supposed to go to the auto-generate EventId code.

* Fixes output of rl.net.cli.test to match the rest of the dotnet project output paths
* Change RoundtripTest to use NativeMethods.StringMarshallingFunc to test that it is symmetric with NativeMethods.StringEncoding
* Changes pseudoloc strings to include the bit that crashed iOS messaging as a known example of potential issues with Unicode
* Removes commented out configuration / code
* Remove superfluous Run_LiveModelChooseRankXYZ test calls (from Test_LiveModel_ChooseRankE2E, they are run in Test_ListModel_ChooseRank below it)
* Add a test to ensure non-nullptr arrays that begin with \0 are marshalled properly as an empty string
@lokitoth lokitoth merged commit c796564 into VowpalWabbit:master Apr 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants