25 MB lightweight cross-platform database client for 100+ databases, including MySQL, PostgreSQL, SQLite, Redis, MongoDB, DuckDB, SQL Server, and Dameng. Built-in AI, MCP Server, CLI, desktop and Docker. | 轻量级跨平台数据库管理工具,支持 MySQL、PostgreSQL、SQLite、Redis、MongoDB、达梦等 100+ 数据库,提供桌面端、Docker、CLI、内置 AI 助手和 MCP。
TypeScript aicliclickhousedatabasedatabase-clientdatabase-managementdockerguimcpmongodbmysqlpostgresqlredisrustsql-serversqlitetaurivue
fix(redis): 优化 UTF-8 展示与提示文案
Bacon2994d6f5c25c1719
diff --git a/crates/dbx-core/src/db/redis_driver.rs b/crates/dbx-core/src/db/redis_driver.rsindex d2b30912c5..61c8a0f8b3 100644--- a/crates/dbx-core/src/db/redis_driver.rs+++ b/crates/dbx-core/src/db/redis_driver.rs@@ -349,6 +349,10 @@ fn redis_bytes_need_escape(bytes: &[u8]) -> bool {}fn redis_bytes_to_display(bytes: &[u8]) -> String {+ if let Ok(text) = std::str::from_utf8(bytes) {+ return text.replace('\\', "\\\\");+ }+let mut output = String::new();for &byte in bytes {match byte {@@ -498,6 +502,13 @@ mod tests {assert_eq!(redis_key_bytes_to_display(&bytes), "\\xac\\xed\\x00\\x05t\\x00A\\\\");}+ #[test]+ fn preserves_utf8_keys_as_readable_text() {+ let bytes = "用户:配置".as_bytes();++ assert_eq!(redis_key_bytes_to_display(bytes), "用户:配置");+ }+#[test]fn round_trips_raw_key_transport() {let bytes = b"\xAC\xED\x00\x05t\x00token";diff --git a/src/components/redis/RedisValueViewer.vue b/src/components/redis/RedisValueViewer.vueindex 8868a68b6f..6a887b4b40 100644--- a/src/components/redis/RedisValueViewer.vue+++ b/src/components/redis/RedisValueViewer.vue@@ -189,7 +189,7 @@ onMounted(load);@input="handleStringInput"/><div v-if="isBinaryStringValue" class="px-4 py-2 border-t text-xs text-muted-foreground shrink-0">- 二进制字符串按转义文本只读展示;当前不支持直接编辑原始字节值。+ {{ t("redis.binaryStringReadonlyHint") }}</div><div v-if="isEditing" class="px-4 py-2 border-t flex justify-end gap-2 shrink-0"><Buttondiff --git a/src/i18n/locales/en.ts b/src/i18n/locales/en.tsindex 229d0b5290..2ef04f1edf 100644--- a/src/i18n/locales/en.ts+++ b/src/i18n/locales/en.ts@@ -532,6 +532,7 @@ export default {members: "{count} members",entries: "{count} entries",noExpiry: "no expiry",+ binaryStringReadonlyHint: "Binary string values are shown as escaped text in read-only mode; editing raw bytes is not supported.",},mongo: {documents: "{count} documents",diff --git a/src/i18n/locales/zh-CN.ts b/src/i18n/locales/zh-CN.tsindex 80b6ea7504..c768e88dc4 100644--- a/src/i18n/locales/zh-CN.ts+++ b/src/i18n/locales/zh-CN.ts@@ -523,6 +523,7 @@ export default {members: "{count} 个成员",entries: "{count} 条记录",noExpiry: "永不过期",+ binaryStringReadonlyHint: "二进制字符串按转义文本只读展示;当前不支持直接编辑原始字节值。",},mongo: {documents: "{count} 个文档",