Invalid character returned by "current date"?

I just noticed that the date-time string returned by current date has what looks like an invalid character. So, for example:

	set my_date_time to (current date) as string

That returns, for example: “Monday, 18 May 2026 at 3:34:26 pm”

The resulting string has space characters between all text items except the last. I’ve run the following to try to identify that last

set theNonSpaceCharacter to character -3 of my_date_time
set theChar to ASCII character of (ASCII number theNonSpaceCharacter)

The ASCII number returned is 63 which AppleScript says is a ?, which can’t be right.

This started happening for me on 11 August 2024 – I use date-time to name log files. I noticed for the first time today so it’s not a big issue.

I guess it’s some kind of invalid character. Is there a way to force current date to return only valid space characters ?

Hi Neophyte.

I can’t test your script immediately without changing my date/time settings. But do you get the same results if you use AppleScript’s current, Unicode-compatible terminology?

set my_date_time to (current date) as text

set theNonSpaceCharacter to character -3 of my_date_time
set theChar to character id (id of theNonSpaceCharacter)

Apple is using a narrow no-break space between the seconds and the ante/post meridiem (am/pm) characters. The UTF-8 code for a narrow no-break space is E2 80 AF.

One can replace that offending space character in an AppleScript date string by the following code:

-- replace the UTF-8 narrow no-break space with a simple space
set adate to (current date) as text
set fixedDate to do shell script "sed 's/\\xe2\\x80\\xaf/\\x20/g' <<<" & adate's quoted form

“Monday, May 18, 2026 at 4:29:18 AM”

Tested: macOS Tahoe 26.5 with Script Editor