Migrate Stream search internals from char to uint8_t#274
Open
asumo-1xts wants to merge 3 commits into
Open
Conversation
Author
|
I just realized that this PR might also fix these issues: |
Author
|
Sorry if my repeated notifications have been noisy. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
This PR is regarding issue #119.
With the current code,
Stream::find()cannot find values above 0x7f because it treats the target string aschar, meaning that many UTF-8 encoded characters cannot be matched either.This PR fixes the issue by changing the target string type from
chartouint8_t.Verification on an actual device
Find single-byte number above 0x7f
When 0x80 is sent via the serial monitor, the sketch below returns "Not found.” with current code while it returns “Found!” this PR's fixed code.
Find multi-byte UTF-8 character
With the current code, the sketch below fails to build with the error
no instance of overloaded function "Serial_::find" matches the argument list. With the fixed code, it builds and works as expected.