diff --git a/pyupgrade.py b/pyupgrade.py
index 25d7e99..1d0636f 100644
--- a/pyupgrade.py
+++ b/pyupgrade.py
@@ -656,6 +656,7 @@ def _fix_encode_to_binary(tokens, i):  # type: (List[Token], int) -> None
                 not _is_ascii(rest) or
                 '\\u' in escapes or
                 '\\U' in escapes or
+                '\\N' in escapes or
                 ('\\x' in escapes and not latin1_ok) or
                 'f' in prefix.lower()
         ):

Possible bug `"/\N{SNOWMAN}".encode("utf-8")` -> `br"/\N{SNOWMAN}"`
Taken from running pyupgrade on Werkzeug's test suite. I think this is the wrong behavior as `"/\N{SNOWMAN}".encode("utf-8")` != `br"/\N{SNOWMAN}"` and therefore this tools should not convert the former to the latter.
diff --git a/tests/binary_literals_test.py b/tests/binary_literals_test.py
index 885d122..1c543fd 100644
--- a/tests/binary_literals_test.py
+++ b/tests/binary_literals_test.py
@@ -13,6 +13,7 @@ from pyupgrade import _fix_tokens
         '"☃".encode("UTF-8")',
         '"\\u2603".encode("UTF-8")',
         '"\\U0001f643".encode("UTF-8")',
+        '"\\N{SNOWMAN}".encode("UTF-8")',
         '"\\xa0".encode("UTF-8")',
         # not byte literal compatible
         '"y".encode("utf16")',

pip install -e .[dev]
parse_log_pytest
requirements.txt
pytest
3.6
requirements-dev.txt
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
attrs==22.2.0
certifi==2021.5.30
cfgv==3.3.1
coverage==6.2
distlib==0.3.9
filelock==3.4.1
identify==2.4.4
importlib-metadata==4.8.3
importlib-resources==5.2.3
iniconfig==1.1.1
mock==5.2.0
nodeenv==1.6.0
packaging==21.3
platformdirs==2.4.0
pluggy==1.0.0
pre-commit==2.17.0
py==1.11.0
pyparsing==3.1.4
pytest==7.0.1
-e git+https://github.com/asottile/pyupgrade.git@34a269fd7650d264e4de7603157c10d0a9bb8211#egg=pyupgrade
PyYAML==6.0.1
tokenize-rt==4.2.1
toml==0.10.2
tomli==1.2.3
typing_extensions==4.1.1
virtualenv==20.16.2
zipp==3.6.0

name: pyupgrade
channels:
  - defaults
  - https://repo.anaconda.com/pkgs/main
  - https://repo.anaconda.com/pkgs/r
  - conda-forge
dependencies:
  - _libgcc_mutex=0.1=main
  - _openmp_mutex=5.1=1_gnu
  - ca-certificates=2025.2.25=h06a4308_0
  - certifi=2021.5.30=py36h06a4308_0
  - ld_impl_linux-64=2.40=h12ee557_0
  - libffi=3.3=he6710b0_2
  - libgcc-ng=11.2.0=h1234567_1
  - libgomp=11.2.0=h1234567_1
  - libstdcxx-ng=11.2.0=h1234567_1
  - ncurses=6.4=h6a678d5_0
  - openssl=1.1.1w=h7f8727e_0
  - pip=21.2.2=py36h06a4308_0
  - python=3.6.13=h12debd9_1
  - readline=8.2=h5eee18b_0
  - setuptools=58.0.4=py36h06a4308_0
  - sqlite=3.45.3=h5eee18b_0
  - tk=8.6.14=h39e8969_0
  - wheel=0.37.1=pyhd3eb1b0_0
  - xz=5.6.4=h5eee18b_1
  - zlib=1.2.13=h5eee18b_1
  - pip:
      - attrs==22.2.0
      - cfgv==3.3.1
      - coverage==6.2
      - distlib==0.3.9
      - filelock==3.4.1
      - identify==2.4.4
      - importlib-metadata==4.8.3
      - importlib-resources==5.2.3
      - iniconfig==1.1.1
      - mock==5.2.0
      - nodeenv==1.6.0
      - packaging==21.3
      - platformdirs==2.4.0
      - pluggy==1.0.0
      - pre-commit==2.17.0
      - py==1.11.0
      - pyparsing==3.1.4
      - pytest==7.0.1
      - pyyaml==6.0.1
      - tokenize-rt==4.2.1
      - toml==0.10.2
      - tomli==1.2.3
      - typing-extensions==4.1.1
      - virtualenv==20.16.2
      - zipp==3.6.0
prefix: /opt/conda/envs/pyupgrade

tests/binary_literals_test.py::test_binary_literals_noop["\\N{SNOWMAN}".encode("UTF-8")]
tests/binary_literals_test.py::test_binary_literals_noop["\u2603".encode("UTF-8")] tests/binary_literals_test.py::test_binary_literals_noop["\\u2603".encode("UTF-8")] tests/binary_literals_test.py::test_binary_literals_noop["\\U0001f643".encode("UTF-8")] tests/binary_literals_test.py::test_binary_literals_noop["\\xa0".encode("UTF-8")] tests/binary_literals_test.py::test_binary_literals_noop["y".encode("utf16")] tests/binary_literals_test.py::test_binary_literals_noop[f"{x}".encode()] tests/binary_literals_test.py::test_binary_literals_noop["foo".encode] tests/binary_literals_test.py::test_binary_literals_noop[("foo".encode)] tests/binary_literals_test.py::test_binary_literals_noop[x.encode()] tests/binary_literals_test.py::test_binary_literals_noop[str.encode(f"{c}")] tests/binary_literals_test.py::test_binary_literals_noop["foo".encode(f"{c}")] tests/binary_literals_test.py::test_binary_literals["foo".encode()-b"foo"] tests/binary_literals_test.py::test_binary_literals["foo".encode("ascii")-b"foo"] tests/binary_literals_test.py::test_binary_literals["foo".encode("utf-8")-b"foo"] tests/binary_literals_test.py::test_binary_literals["\\xa0".encode("latin1")-b"\\xa0"] tests/binary_literals_test.py::test_binary_literals["\\\\u tests/binary_literals_test.py::test_binary_literals["\\\\x tests/binary_literals_test.py::test_binary_literals[f(\n
pyupgrade.py
pyupgrade.py