I came across a phone number that ended in a zero-width, non-printing (U+202C, "Pop Directional Formatting").
This could be fixed either by cleaning up the database or in client side code by replacing all whitespace with a single whitespace, and then removing any characters except those in the ascii ranges of
I'll write in JavaScript for ease of translation to any other frontend or backend language:
function sanitize(tel) {
phone = phone
.replace(/\s+/g, ' ') // replace all whitespace with a single space
.replace(/[^ -;]/, '') // remove all characters except in the ascii range between space and semicolon (includes # + , . ( ) etc)
.trim() // trim leading and trailing whitespace
}
// Test cases
// I've pasted this with the U+202C (granted, it may not survive the BB submit)
sanitize(`+1 (385) 555-1337`) // `+ 1 (385) 555-1337`
// this could easily be extended to include alphas (e.g. p, w) if desired
sanitize(`+1 (ban) ana-1337`) // `+1 () -1337`
sanitize(`+ 1 (385) 555-1337#10,2,2;2*`) // `+ 1 (385) 555-1337#10,2,2;2*`
sanitize(" ") // ""
Also, since there are a very limited number of phone number formats around the globe, this could be further cleaned up in terms on consistent formatting by recognizing the +1 or country of the individual, removing non-touch-tone separator characters ( ) . - and leave control characters like # , etc and if the length of the number before # matches the expected number of characters and pattern, then rewrite the number in canonical form in the database (e.g. +13855551337), and apply a client-side formatter to represent a localized form (e.g. (385) 555-1337).
Similarly, a pattern could be used to apply formatting to invalid data for easier recognition by ward leaders who are trying to clean up the data.
Invalid invisible unicode characters in phone numbers
Discussions about the Leader and Clerk Resources on lds.org.
1 post
• Page 1 of 1
-
coolaj86
- New Member
- Posts: 2
- Joined: Fri Jan 17, 2014 10:29 am
Invalid invisible unicode characters in phone numbers
Post by coolaj86 »
1 post
• Page 1 of 1
Return to “Leader and Clerk Resources”
Jump to
- What's New
- ↳ Announcements & Policies
- ↳ Virtual Meetings
- ↳ In The News
- ↳ Links & Resources
- Church Technology for Members
- ↳ Main Church Website
- ↳ Calendar
- ↳ Ward Directory and Map
- ↳ Leader and Clerk Resources
- ↳ Notes and Journal, and Online Scriptures
- ↳ Online Donations
- ↳ Beta Testing
- ↳ Beta Calendar
- ↳ Beta Directory
- ↳ Beta Lesson Schedules
- ↳ Beta Maps
- ↳ Beta Newsletter
- ↳ Beta Clerk Resources
- ↳ Other Websites
- ↳ Mobile Applications
- ↳ Gospel Library
- ↳ Android Gospel Library
- ↳ iPhone/iPad Gospel Library
- ↳ Gospel Library for Windows
- ↳ Gospel Living App
- ↳ Gospel Media
- ↳ Member Tools
- ↳ Android Member Tools App
- ↳ iPhone/iPad Member Tools App
- ↳ Mormon Radio Channel
- ↳ Church Account
- ↳ Family History
- ↳ FamilySearch Products
- ↳ FamilySearch Family Tree Application
- ↳ FamilySearch Indexing
- ↳ FamilySearch Centers
- ↳ Genealogy Industry Issues
- ↳ Software Development
- ↳ Other Member Technologies
- ↳ Church Historical Timeline
- ↳ Emerging Technologies
- ↳ Accessibility to Church Technology Products
- ↳ ePublishing
- ↳ Audiobooks
- ↳ E-Books
- ↳ Interactive Books & Magazines
- Community Discussions
- ↳ General Discussions
- ↳ Family Safety with Technology
- Clerk Support
- ↳ Getting Started for New Clerks
- ↳ Reports and Forms
- ↳ Local Unit Finance
- ↳ Membership Help
- ↳ General Clerk Discussions
- Meetinghouse Technologies
- ↳ Meetinghouse Internet
- ↳ Clerk Computers
- ↳ Printers, Copiers, and Multi-Function Devices
- ↳ FAQs for Local Unit Copier Program
- ↳ Broadcasts and Conferences
- ↳ Interactive Virtual Meetings
- ↳ Non-Interactive Webcasting
- ↳ Stake Conference with Remote Participants
- ↳ Satellite
- ↳ Receiving Internet Broadcasts
- ↳ Rich Media in Lessons and Training
- ↳ Meetinghouse Audio
- ↳ Phones
- ↳ Other Meetinghouse Technologies
- ↳ Stake Technology Specialist Training
- Audiovisual Media and Emerging Technologies
- ↳ Getting Started
- ↳ Digital Media
- ↳ General Media Discussions
- Help & Feedback
- ↳ Help with this forum