From 038aa948eb9fbf2880a88b453373888b5bccbe17 Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Thu, 27 Jan 2022 14:33:23 +0100 Subject: [PATCH] fix contract terms normalization --- packages/taler-util/src/helpers.ts | 5 +---- .../taler-wallet-cli/src/integrationtests/test-payment.ts | 8 ++++++++ 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/packages/taler-util/src/helpers.ts b/packages/taler-util/src/helpers.ts index 6c836c482..7d84d434e 100644 --- a/packages/taler-util/src/helpers.ts +++ b/packages/taler-util/src/helpers.ts @@ -63,10 +63,7 @@ export function canonicalJson(obj: any): string { // Check for cycles, etc. obj = JSON.parse(JSON.stringify(obj)); if (typeof obj === "string") { - const s = JSON.stringify(obj); - return s.replace(/[\u007F-\uFFFF]/g, function (chr) { - return "\\u" + ("0000" + chr.charCodeAt(0).toString(16)).substr(-4); - }); + return JSON.stringify(obj); } if (typeof obj === "number" || typeof obj === "boolean" || obj === null) { return JSON.stringify(obj); diff --git a/packages/taler-wallet-cli/src/integrationtests/test-payment.ts b/packages/taler-wallet-cli/src/integrationtests/test-payment.ts index 967d491be..d76bb6762 100644 --- a/packages/taler-wallet-cli/src/integrationtests/test-payment.ts +++ b/packages/taler-wallet-cli/src/integrationtests/test-payment.ts @@ -49,6 +49,14 @@ export async function runPaymentTest(t: GlobalTestState) { await makeTestPayment(t, { wallet, merchant, order }); + const order2 = { + summary: "Testing “unicode” characters", + amount: "TESTKUDOS:5", + fulfillment_url: "taler://fulfillment-success/thx", + }; + + await makeTestPayment(t, { wallet, merchant, order: order2 }); + await wallet.runUntilDone(); }