From cc5303fa11650358883fb6e48d2f35713cdf85e1 Mon Sep 17 00:00:00 2001 From: Ian Dunn Date: Mon, 21 Oct 2019 12:24:10 -0700 Subject: [PATCH] Pledges: URL encode JSON data to avoid i18n character issues. --- plugins/wporg-5ftf/includes/shortcodes.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/plugins/wporg-5ftf/includes/shortcodes.php b/plugins/wporg-5ftf/includes/shortcodes.php index 54a7765..379b4b1 100755 --- a/plugins/wporg-5ftf/includes/shortcodes.php +++ b/plugins/wporg-5ftf/includes/shortcodes.php @@ -60,7 +60,10 @@ function enqueue_scripts() { ); } - $inline_script = sprintf( 'var fiveFutureCompanies = %s;', wp_json_encode( $companies ) ); + $inline_script = sprintf( + 'var fiveFutureCompanies = JSON.parse( decodeURIComponent( \'%s\' ) );', + rawurlencode( wp_json_encode( $companies ) ) + ); wp_enqueue_style( '5ftf-front-end' ); wp_enqueue_script( '5ftf-list' );