From 47bb9a7571bfc52ad5fa0db1d112263a2b622b20 Mon Sep 17 00:00:00 2001 From: David Lechner Date: Sun, 27 Oct 2024 15:20:19 -0500 Subject: [PATCH] bricks/_common/mpconfigport: Enable unicode. Enable MICROPY_PY_BUILTINS_STR_UNICODE on hubs with PYBRICKS_OPT_EXTRA_LEVEL2. Without this, there is not any difference between str and bytes, which can make it hard to work with multi-byte characters. --- CHANGELOG.md | 2 +- bricks/_common/mpconfigport.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 049ae0ce6..f906899b6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,7 +16,7 @@ state. ### Changed - +- Enabled UTF-8 support for `str` objects. - The method `DriveBase.angle()` now returns a float ([support#1844]). This makes it properly equivalent to `hub.imu.heading`. - Re-implemented tilt using the gyro data by default. Pure accelerometer tilt diff --git a/bricks/_common/mpconfigport.h b/bricks/_common/mpconfigport.h index d345f4df3..4deebdc7f 100644 --- a/bricks/_common/mpconfigport.h +++ b/bricks/_common/mpconfigport.h @@ -80,6 +80,7 @@ #define MICROPY_PY_BUILTINS_SLICE (PYBRICKS_OPT_EXTRA_LEVEL1) #define MICROPY_PY_BUILTINS_PROPERTY (0) #define MICROPY_PY_BUILTINS_MIN_MAX (1) +#define MICROPY_PY_BUILTINS_STR_UNICODE (PYBRICKS_OPT_EXTRA_LEVEL2) #define MICROPY_PY___FILE__ (0) #define MICROPY_PY_MICROPYTHON_MEM_INFO (1) #define MICROPY_PY_GC (PYBRICKS_OPT_EXTRA_LEVEL1)