22

Whenever I use Contacts.app to fill out a form on a website, I have a problem with any phone number field.

Contacts.app adds unicode "left-to-right override" (U+202D codepoint: E2 80 AD in UTF-8 contexts, 20 2D in UTF-16 contexts) before the first digit, and "pop directional formatting" (U+202C codepoint: E2 80 AC in UTF-8 contexts, 20 2C in UTF-16 contexts) after the last digit. Many websites get upset by this, because those are not recognised as valid phone number digits. As they are zero-width symbols, the first few times I saw this problem I didn't even understand what was going wrong.

Note that this still happens if I turn off JavaScript or use a desktop text editor like TextWrangler (TextWrangler is how I originally found out which zero-width symbols were being inserted); as it happens, I only care about websites because websites are the only thing which validates that phone numbers match a pattern such as the regex [0-9()+\s]*

This happens with all phone numbers in Contacts, regardless of whose (some are formatted as UK, some as USA, some as German).

Method: open Contacts.app, select any person, double (or triple) click on a phone number to select all of it, ⌘C-⌘V to copy-paste; if I paste into an app which shows non-printable characters like TextWrangler then I can see their existence, if I paste into a web browser it's present but zero-width, as arrow keys 'stick' at those positions and the delete key does in fact remove them.

It happens as described in both Safari and Chrome. In Firefox, it behaved slightly differently, and seemed to automatically delete the extra characters as soon as I pass through them with my arrow keys (?!).

How do I stop Contacts.app from adding these unicode symbols?

15
  • 1
    can we have a screen shot, you know picture speaks 1000 words
    – Ruskes
    Commented Sep 20, 2018 at 23:54
  • also which browser are you using
    – Ruskes
    Commented Sep 21, 2018 at 0:10
  • 1
    @Buscar웃 screens it's won't show zero width characters and so I can't see how that would help
    – mmmmmm
    Commented Sep 22, 2018 at 9:46
  • 2
    I too am having this problem. I did not have it with my US number, but when I moved and got a Swedish number, Apple Contacts did this. I have tried everything to remove it. Deleting my card, recreating it. Deleting the number and re-adding it by typing. I cannot get rid of these invisible characters in my phone number in Apple Contacts. Commented Jan 14, 2019 at 13:22
  • 1
    @VicJang if anyone solved it they never told me the solution, as it still affects me.
    – BenRW
    Commented Jul 7, 2020 at 21:29

3 Answers 3

9

Update Sep 2024: Another year has gone by. Incredibly, this is still NOT fixed as of macOS 15.0 Sequoia / Contacts.app Version 14.0 (2589).

Adding another reason why this is isn't simply a cosmetic problem. Recently I was adding an address on Amazon and got blocked. It kept telling me "remove invalid characters from phone number field". I'd forgotten about this old bug and wasted a lot of time checking, re-pasting and trying to format the number in various ways. Finally I remembered—Apple does not care about Contacts.app!

amazon-doesnt-like-it


I've filed bugs #47763641 & #5235503 with Apple, and I encourage others to report it. Hopefully one day it will receive some attention. With each new macOS release, I lose more faith that they will— it's already survived 5 major OS releases and dozens of minor point updates.

Repro steps

  1. From Contacts.app, right-click → Copy on a phone number.
  2. Paste into Sublime Text or any other plaintext editor.
  3. Save as test.txt
  4. Open in a Hex Editor, I used Hex Fiend in this example
  5. You can now see the extra bytes (I highlighted them below)

zwsp-chars-screenshot

A couple of bits of information:

  1. This seems to only affect phone# fields. Others such as email, addresses, notes etc don't exhibit this bug.
  2. If, instead of using ⌘command + A (select-all), you very carefully select just from the start of the phone# to the end and then copy, the unwanted zwsp characters aren't copied.

My workarounds for now

  1. I've removed Contacts.app from my Dock and replaced it with Cardhop, which correctly copies phone numbers.
  2. An Alfred workflow luckman212/alfred-copy-workaround that I mapped to ⌘⇧C that copies the selected field and trims the whitespace. Not exactly elegant, but it works well enough until Apple fixes this.
5
  • 4
    The time is August 2022. I'm using an Apple M1 MacBook Pro with macOS Monterey 12.5 and this freaking problem still exists. Are they not aware of the issue or what..
    – Vic Jang
    Commented Aug 22, 2022 at 17:31
  • 4
    I filed a new bug report. Hopefully it makes a difference.
    – Vic Jang
    Commented Aug 22, 2022 at 17:44
  • 1
    @VicJang The time is September 2023. Another year, another major OS update goes by without a fix for this.
    – luckman212
    Commented Sep 27, 2023 at 12:30
  • "An Alfred workflow that I mapped to ⌘⇧C that copies the selected field and trims the whitespace. Not exactly elegant, but it works well enough until Apple fixes this." I have Alfred but never used workflows. Can you explain how to add this one? Commented Dec 2, 2023 at 18:54
  • @JohnSpringer I uploaded the workflow to GitHub and updated my answer to point to the repo. Workflows are basically the only reason to use Alfred, so you should really explore them!
    – luckman212
    Commented Dec 3, 2023 at 18:34
3

Not an answer, but a confirmation (to rebut the answer that says that Contacts is not doing it).

Here is the result of pasting Apple's support number that I typed into Contacts and then copy/pasted into od -bc:

% od -bc
‭(800) 275-2273‬0000000   342 200 255 050 070 060 060 051 040 062 067 065 055 062 062 067
         342 200 255   (   8   0   0   )       2   7   5   -   2   2   7
0000020   063 342 200 254                                                
           3 342 200 254                                                
0000024

I contacted Apple with a support request, escalated the request to the second level and successfully got the support person to verify that this is still happening (on 13.1) on his own computer.

I've written up detailed steps to reproduce and sent them through as a bug report attached to my case. We'll see what happens.

But you're not crazy - Contacts DOES insert extraneous characters before and after phone numbers copy/pasted.

2

Thanks for confirming this behaviour. I've just had a Mac user complaining that outbound calls from their MS Teams app were failing due to malformed dialstrings.

As you can't make macOS or Contacts use a specific app to place calls, they were cutting and pasting the number from Contacts into the dialpad in Teams. The dial string normalisation regex to transform UK mobile numbers (with an 07 prefix) into e164 was failing because of the hidden characters.

edit

It turns out you can change the default calling app in macOS, the setting’s just in a non-obvious place (ie. the Contacts app or System Settings). Open FaceTime and go to Settings in the menu. From there you can set MS Teams as your default app for calls

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .