Rock icon indicating copy to clipboard operation
Rock copied to clipboard

Serialization Error | Special Characters in Name Field Cause Errors on Multiple Pages

Open jamrphy-bwd opened this issue 10 months ago • 1 comments

Description

For reasons unknown to man, someone's last name was composed of Mathematical sans-serif Unicode characters. Since updating from 14.4 to 15.5, this has caused errors on many pages that interface with Person data, including Connection Requests, Person Profile, etc. (any page with the relevant person)

For instance, Testy 𝖬cTesterson on the demo. The "M" is U+1D5AC. He is unviewable and uneditable.

Actual Behavior

Receiving errors: Unable to translate Unicode character \uD835 at index 4816 to specified code page. causing Error serializing value

image

Outside of just Person data, special characters in the Demo's Contact Us Inquiry field also causes an error, so this is a broader issue:

image

Expected Behavior

Ideally, if data doesn't fail a validation, it shouldn't cause errors. Maybe there could be extra validations on things like Person names, but the cleaner, universal fix would probably be broader support for Unicode.

Steps to Reproduce

  • Go to Demo Site
  • Click Login -> Register
  • Register a new Person with your favorite mathematical character in the name (or some other unsupported Unicode characters)
  • See error. (You'll need to clear your cookies to access anything else on the demo, as a person Logged in with these special characters sees nothing but errors!)

Issue Confirmation

  • [X] Perform a search on the Github Issues to see if your bug or enhancement is already reported.
  • [X] Try to reproduce the problem on a fresh install or on the demo site.

Rock Version

15.5, 16.2

Client Culture Setting

en-US

jamrphy-bwd avatar Apr 24 '24 18:04 jamrphy-bwd

@jamrphy-bwd We're looking into the first part of this issue, but the second part is addressed in Rock v16.4 with the implementation of the relaxedUrlToFileSystemMapping="false" mentioned in issue 4436.

ref: 𝗠

nairdo avatar Apr 25 '24 17:04 nairdo

We're experiencing the same issue in a few different ways. The first example is from the Bulk Update on a Group, but a member (or members) has an emoji/unicode character in their name(first/last or nickname).

Bulk Update Exception

Screenshot 2024-08-29 at 12 06 58 PM


Person Profile Exceptions

Screenshot 2024-08-29 at 12 07 24 PM As shown above, Mel's profile can be viewed in Rock without error. Their Avatar looks strange because the first letter of their name is an emoji: Screenshot 2024-08-29 at 12 15 05 PM

Screenshot 2024-08-29 at 12 10 40 PM This second example is from a Person record who had an American flag emoji in their name. That profile doesn't load at all. You can notice in this example that the GetAvatar endpoint causes issues.


I'm not sure what the difference is between either of these profiles specifically. They both start with emojis yet one loads and the other doesn't. We experienced this issue a couple months ago when searching Person records in the REST API, so that's an area to look into as well.

My suggestions would be to either validate Person names when they're created/modified, or to encode/decode the characters in a way that doesn't break a page. The Zod Typescript library enabled emoji support last year and in their implementation they used a regex: https://thekevinscott.com/emojis-in-javascript/#writing-a-regular-expression

This regex can be made more readable by using Unicode property escapes: https://unicode.org/reports/tr51/#Emoji_Properties

That technique enabled Zod to make it as readable as:

const _emojiRegex = `^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;

https://github.com/colinhacks/zod/blame/8552233c77426f77d3586cc877f7aec1aa0aa45b/src/types.ts#L605

ghost avatar Aug 29 '24 19:08 ghost

@nlBayside Thank you for the comment. I will add these details to our internal ticket.

chead4 avatar Aug 29 '24 20:08 chead4