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

Update Utf8String.SanitizeString, add GetParts #1287

Merged
merged 3 commits into from
Jan 23, 2025

Conversation

Haselnussbomber
Copy link
Contributor

Summary:

  • Added an AllowedEntities enum for the Utf8String.SanitizeString function.
  • Added Utf8String.GetParts, which extracts the different texts and payloads from a string and adds them to a vector.

Regarding SanitizeString:

The commonly used flags 0x27F, which I don't know where those comes from, allow the following:

  • UppercaseLetters
  • LowercaseLetters
  • Numbers
  • SpecialCharacters
  • CharacterList
  • NewLines
  • Payloads
  • Unknown9 (Chinese/Korean client specific?)

GetParts Example:

var str = Utf8String.FromSequence(ReadOnlySeString.FromMacroString("<string(gstr1)><string(gstr2)><bold(1)>Hello @ World<bold(0)>"));
var vector = new StdVector<Utf8StringPart>();

str->GetParts(&vector);

foreach (var part in vector)
{
    ImGui.TextUnformatted($"Payload: {new ReadOnlySeStringSpan(part.Payload.AsSpan()).ToString()}");
    ImGui.TextUnformatted($"Text: {new ReadOnlySeStringSpan(part.Text.AsSpan()).ToString()}");
    ImGui.Separator();

    part.Payload.Dtor();
    part.Text.Dtor();
}

Renders:

Screenshot

@github-actions github-actions bot added the breaking change PR contains breaking changes and wont be merged before a new patch label Jan 23, 2025
@Haselnussbomber
Copy link
Contributor Author

Haselnussbomber commented Jan 23, 2025

Renamed NewLines to Unicode, which is still incorrect, but eh..
It's basically everything(?) not handled by the alphanumerical and special characters filters.
If anyone has a better suggestion, let's hear it.

Unicode

@wolfcomp
Copy link
Collaborator

Could you check a bit more into what is chucked into the unicode parts?
For instance, is it all the latin characters that is region specific?

Copy link
Contributor

Breaking Changes

Member exists in left but not in right

FFXIVClientStructs.FFXIV.Client.System.String.Utf8String.Delegates: 1

SanitizeString: 2

  • void Invoke(FFXIVClientStructs.FFXIV.Client.System.String.Utf8String*, ushort, FFXIVClientStructs.FFXIV.Client.System.String.Utf8String*)
  • System.IAsyncResult BeginInvoke(FFXIVClientStructs.FFXIV.Client.System.String.Utf8String*, ushort, FFXIVClientStructs.FFXIV.Client.System.String.Utf8String*, System.AsyncCallback, object)

@Haselnussbomber
Copy link
Contributor Author

Haselnussbomber commented Jan 23, 2025

The screenshot above was just me trying to figure out what the function allows for certain UnicodeRanges (statics in C#): https://gist.github.com/Haselnussbomber/efba876a0c6e6f5a41539dde39f0f338

Renamed Unicode to OtherCharacters.

@wolfcomp wolfcomp merged commit 7bdad77 into aers:main Jan 23, 2025
4 of 5 checks passed
@Haselnussbomber Haselnussbomber deleted the serialize-flag branch January 23, 2025 18:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking change PR contains breaking changes and wont be merged before a new patch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants