Entering UTF-8 code points in Find and Replace

Everything related to our flagship word processor.
Post Reply
User avatar
xiamenese
Posts: 543
Joined: 2006-12-08 00:46:44
Location: London or Exeter, UK

Entering UTF-8 code points in Find and Replace

Post by xiamenese »

A really basic question, I'm afraid:

How does one enter a unicode code point into a PowerFind Pro or other RegEx enabled Find and Replace dialogue?

The purpose is to replace a given symbol from the emoji and symbols list, with a similar glyph in a specific font (music notation font), but which is at a different code point, but where copying and pasting in won't work.

Thanks

Mark
adryan
Posts: 563
Joined: 2014-02-08 12:57:03
Location: Australia

Re: Entering UTF-8 code points in Find and Replace

Post by adryan »

G'day, Mark et al

As an example, the Unicode code for lowercase "t" is U+0074. You can determine this either from the System's Character Viewer or (once an instance of the character is selected) from Nisus Writer's Formatting Examiner.

The Find/Replace expression you want (in PowerFind Pro) is then "\U0074" (without the quotes).

Cheers,
Adrian
MacBook Pro (M1 Pro, 2021)
macOS Ventura
Nisus Writer user since 1996
User avatar
xiamenese
Posts: 543
Joined: 2006-12-08 00:46:44
Location: London or Exeter, UK

Re: Entering UTF-8 code points in Find and Replace

Post by xiamenese »

adryan wrote: 2023-06-22 13:14:26 G'day, Mark et al

<snip>

The Find/Replace expression you want (in PowerFind Pro) is then "\U0074" (without the quotes).

Cheers,
Adrian
Hi Adrian,

That was the bit that I needed to know; thank you. Can I point out, though, that while "\Uxxxx" works in NWP, it fails in other regex-enabled apps like Scrivener which are also built on the same Apple TextKit. In Scrivener, the "u" must be lowercase, and I would suspect this to be more canonical.

:D

Mark
User avatar
martin
Official Nisus Person
Posts: 5228
Joined: 2002-07-11 17:14:10
Location: San Diego, CA
Contact:

Re: Entering UTF-8 code points in Find and Replace

Post by martin »

xiamenese wrote: 2023-06-24 08:35:33 Can I point out, though, that while "\Uxxxx" works in NWP, it fails in other regex-enabled apps like Scrivener which are also built on the same Apple TextKit. In Scrivener, the "u" must be lowercase, and I would suspect this to be more canonical.
You can also use \u0074 in Nisus Writer. But you're right that there are subtle variations in the regex dialect. Nisus Writer uses an open source regex engine, not the stock engine provided by Apple as part of macOS.
User avatar
xiamenese
Posts: 543
Joined: 2006-12-08 00:46:44
Location: London or Exeter, UK

Re: Entering UTF-8 code points in Find and Replace

Post by xiamenese »

martin wrote: 2023-06-26 08:44:40
xiamenese wrote: 2023-06-24 08:35:33 Can I point out, though, that while "\Uxxxx" works in NWP, it fails in other regex-enabled apps like Scrivener which are also built on the same Apple TextKit. In Scrivener, the "u" must be lowercase, and I would suspect this to be more canonical.
You can also use \u0074 in Nisus Writer. But you're right that there are subtle variations in the regex dialect. Nisus Writer uses an open source regex engine, not the stock engine provided by Apple as part of macOS.
Thanks so much, Martin. I did know that /uxxxx works in NWP, but it has always puzzled me where the slight differences in the Scrivener RegEx implementation came from, e.g. \L to Lowercase a letter works in NWP, but not in Scrivener; now I know, so thank you. Can I ask which RegEx engine you use?

:)

Mark
User avatar
martin
Official Nisus Person
Posts: 5228
Joined: 2002-07-11 17:14:10
Location: San Diego, CA
Contact:

Re: Entering UTF-8 code points in Find and Replace

Post by martin »

xiamenese wrote: 2023-06-27 05:42:35 Can I ask which RegEx engine you use?
Of course! :) Nisus Writer uses the Oniguruma regex engine.
User avatar
xiamenese
Posts: 543
Joined: 2006-12-08 00:46:44
Location: London or Exeter, UK

Re: Entering UTF-8 code points in Find and Replace

Post by xiamenese »

Thanks Martin. :D

Mark
Post Reply