From dffc01dc51efd6b2b159727f8bafe09670b3f420 Mon Sep 17 00:00:00 2001 From: limeng <1131177064@qq.com> Date: Sat, 7 Nov 2026 18:41:31 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E6=8A=A5=E4=BB=B7?= =?UTF-8?q?=E7=A1=AE=E8=AE=A4=E5=8D=95=20PDF=20=E6=96=B9=E6=A1=86=E4=B9=B1?= =?UTF-8?q?=E7=A0=81=20(#993)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../business/pdf/courier-quote.blade.php | 8 +- tests/Unit/CourierQuotePdfWhitespaceTest.php | 99 +++++++++++++++++++ 2 files changed, 104 insertions(+), 3 deletions(-) create mode 100644 tests/Unit/CourierQuotePdfWhitespaceTest.php diff --git a/resources/views/business/pdf/courier-quote.blade.php b/resources/views/business/pdf/courier-quote.blade.php index 82bd66ec..58071637 100644 --- a/resources/views/business/pdf/courier-quote.blade.php +++ b/resources/views/business/pdf/courier-quote.blade.php @@ -43,7 +43,9 @@
@php $mixedText = static function ($value): string { - $parts = preg_split('/([\x20-\x7E]+)/', (string) $value, -1, PREG_SPLIT_DELIM_CAPTURE) ?: []; + // Spreadsheet-pasted whitespace has no glyph in the CJK font. + $text = str_replace(["\r\n", "\r", "\t", "\u{00A0}"], ["\n", "\n", ' ', ' '], (string) $value); + $parts = preg_split('/([\x20-\x7E]+)/', $text, -1, PREG_SPLIT_DELIM_CAPTURE) ?: []; return implode('', array_map(static function (string $part): string { $escaped = e($part); @@ -57,7 +59,7 @@{!! $mixedText($version->carrier_name) !!} · {!! $mixedText($version->quote_type) !!}
+{!! $mixedText($version->carrier_name) !!} · {!! $mixedText($version->quote_type) !!}