WC CLI list name field to json with special characters
-
I am trying to use WooCommerce CLI to display product names in json format.
So my command iswp wc product list --field=name --format=json
It works, but since the product names are not in English, they contain special characters such as
?
?
ó
?
?
, etc.Json format displays this as:
\u0141\u00d3\u017bKO KORA 16
How to fix it?
Ps. my charset settings in wp-config:
define( 'DB_CHARSET', 'utf8mb4' );
define( 'DB_COLLATE', '' );
Ps. Tested on Ubuntu
- This topic was modified 2 years, 10 months ago by Kris Kelvin.
-
Hi @kanlukasz
In order for us to get a better idea of your setup, could you please share a copy of your site’s System Status?
You can find it via WooCommerce > Status. Select “Get system report” and then “Copy for support”. Once you’ve done that, paste it here in your response.
### WordPress Environment ### WordPress address (URL): xxxxxxxxxxxxxxx Site address (URL): xxxxxxxxxxxxxxx WC Version: 6.0.0 REST API Version: ? 6.0.0 WC Blocks Version: ? 6.3.3 Action Scheduler Version: ? 3.3.0 WC Admin Version: ? 2.9.4 Log Directory Writable: ? WP Version: 5.8.2 WP Multisite: – WP Memory Limit: 256 MB WP Debug Mode: ? WP Cron: ? Language: pl_PL External object cache: – ### Server Environment ### Server Info: Apache/2.4.51 (Ubuntu) PHP Version: 8.0.12 PHP Post Max Size: 64 MB PHP Time Limit: 60 PHP Max Input Vars: 10000 cURL Version: 7.68.0 OpenSSL/1.1.1f SUHOSIN Installed: – MySQL Version: 5.5.5-10.3.31-MariaDB-0ubuntu0.20.04.1 Max Upload Size: 8 MB Default Timezone is UTC: ? fsockopen/cURL: ? SoapClient: ? DOMDocument: ? GZip: ? Multibyte String: ? Remote Post: ? Remote Get: ? ### Database ### WC Database Version: 6.0.0 WC Database Prefix: xxxxxxxxx_ Ca?kowity rozmiar bazy danych: 4.73MB Rozmiar bazy danych: 2.84MB Rozmiar indeksu bazy danych: 1.89MB xxxxxxxxx_woocommerce_sessions: Dane: 0.02MB + Indeks: 0.02MB + Silnik InnoDB xxxxxxxxx_woocommerce_api_keys: Dane: 0.02MB + Indeks: 0.03MB + Silnik InnoDB xxxxxxxxx_woocommerce_attribute_taxonomies: Dane: 0.02MB + Indeks: 0.02MB + Silnik InnoDB xxxxxxxxx_woocommerce_downloadable_product_permissions: Dane: 0.02MB + Indeks: 0.06MB + Silnik InnoDB xxxxxxxxx_woocommerce_order_items: Dane: 0.02MB + Indeks: 0.02MB + Silnik InnoDB xxxxxxxxx_woocommerce_order_itemmeta: Dane: 0.02MB + Indeks: 0.03MB + Silnik InnoDB xxxxxxxxx_woocommerce_tax_rates: Dane: 0.02MB + Indeks: 0.06MB + Silnik InnoDB xxxxxxxxx_woocommerce_tax_rate_locations: Dane: 0.02MB + Indeks: 0.03MB + Silnik InnoDB xxxxxxxxx_woocommerce_shipping_zones: Dane: 0.02MB + Indeks: 0.00MB + Silnik InnoDB xxxxxxxxx_woocommerce_shipping_zone_locations: Dane: 0.02MB + Indeks: 0.03MB + Silnik InnoDB xxxxxxxxx_woocommerce_shipping_zone_methods: Dane: 0.02MB + Indeks: 0.00MB + Silnik InnoDB xxxxxxxxx_woocommerce_payment_tokens: Dane: 0.02MB + Indeks: 0.02MB + Silnik InnoDB xxxxxxxxx_woocommerce_payment_tokenmeta: Dane: 0.02MB + Indeks: 0.03MB + Silnik InnoDB xxxxxxxxx_woocommerce_log: Dane: 0.02MB + Indeks: 0.02MB + Silnik InnoDB xxxxxxxxx_actionscheduler_actions: Dane: 0.06MB + Indeks: 0.13MB + Silnik InnoDB xxxxxxxxx_actionscheduler_claims: Dane: 0.02MB + Indeks: 0.02MB + Silnik InnoDB xxxxxxxxx_actionscheduler_groups: Dane: 0.02MB + Indeks: 0.02MB + Silnik InnoDB xxxxxxxxx_actionscheduler_logs: Dane: 0.06MB + Indeks: 0.03MB + Silnik InnoDB xxxxxxxxx_commentmeta: Dane: 0.02MB + Indeks: 0.03MB + Silnik InnoDB xxxxxxxxx_comments: Dane: 0.02MB + Indeks: 0.09MB + Silnik InnoDB xxxxxxxxx_links: Dane: 0.02MB + Indeks: 0.02MB + Silnik InnoDB xxxxxxxxx_options: Dane: 1.09MB + Indeks: 0.08MB + Silnik InnoDB xxxxxxxxx_postmeta: Dane: 0.52MB + Indeks: 0.41MB + Silnik InnoDB xxxxxxxxx_posts: Dane: 0.27MB + Indeks: 0.06MB + Silnik InnoDB xxxxxxxxx_termmeta: Dane: 0.02MB + Indeks: 0.03MB + Silnik InnoDB xxxxxxxxx_terms: Dane: 0.02MB + Indeks: 0.03MB + Silnik InnoDB xxxxxxxxx_term_relationships: Dane: 0.08MB + Indeks: 0.06MB + Silnik InnoDB xxxxxxxxx_term_taxonomy: Dane: 0.02MB + Indeks: 0.03MB + Silnik InnoDB xxxxxxxxx_usermeta: Dane: 0.02MB + Indeks: 0.03MB + Silnik InnoDB xxxxxxxxx_users: Dane: 0.02MB + Indeks: 0.05MB + Silnik InnoDB xxxxxxxxx_wc_admin_notes: Dane: 0.02MB + Indeks: 0.00MB + Silnik InnoDB xxxxxxxxx_wc_admin_note_actions: Dane: 0.02MB + Indeks: 0.02MB + Silnik InnoDB xxxxxxxxx_wc_category_lookup: Dane: 0.02MB + Indeks: 0.00MB + Silnik InnoDB xxxxxxxxx_wc_customer_lookup: Dane: 0.02MB + Indeks: 0.03MB + Silnik InnoDB xxxxxxxxx_wc_download_log: Dane: 0.02MB + Indeks: 0.03MB + Silnik InnoDB xxxxxxxxx_wc_order_coupon_lookup: Dane: 0.02MB + Indeks: 0.03MB + Silnik InnoDB xxxxxxxxx_wc_order_product_lookup: Dane: 0.02MB + Indeks: 0.06MB + Silnik InnoDB xxxxxxxxx_wc_order_stats: Dane: 0.02MB + Indeks: 0.05MB + Silnik InnoDB xxxxxxxxx_wc_order_tax_lookup: Dane: 0.02MB + Indeks: 0.03MB + Silnik InnoDB xxxxxxxxx_wc_product_meta_lookup: Dane: 0.02MB + Indeks: 0.09MB + Silnik InnoDB xxxxxxxxx_wc_rate_limits: Dane: 0.02MB + Indeks: 0.02MB + Silnik InnoDB xxxxxxxxx_wc_reserved_stock: Dane: 0.02MB + Indeks: 0.00MB + Silnik InnoDB xxxxxxxxx_wc_tax_rate_classes: Dane: 0.02MB + Indeks: 0.02MB + Silnik InnoDB xxxxxxxxx_wc_webhooks: Dane: 0.02MB + Indeks: 0.02MB + Silnik InnoDB ### Post Type Counts ### acf-field: 27 acf-field-group: 7 attachment: 19 customize_changeset: 3 nav_menu_item: 111 page: 13 post: 2 product: 150 revision: 42 shop_coupon: 1 shop_order: 1 wpcf7_contact_form: 1 ### Security ### Secure connection (HTTPS): ? Hide errors from visitors: ? ### Active Plugins (6) ### Advanced Custom Fields PRO: przez Delicious Brains – 5.11.4 Klasyczny edytor: przez Kontrybutorzy WordPressa – 1.6.2 Classic Widgets: przez WordPress Contributors – 0.2 Contact Form 7: przez Takayuki Miyoshi – 5.5.3 WooCommerce: przez Automattic – 6.0.0 ### Inactive Plugins (0) ### ### Must Use Plugins (0) ### ### Settings ### API Enabled: – Force SSL: – Currency: PLN (z?) Currency Position: right_space Thousand Separator: Decimal Separator: , Number of Decimals: 2 Taxonomies: Product Types: external (external) grouped (grouped) simple (simple) variable (variable) Taxonomies: Product Visibility: exclude-from-catalog (exclude-from-catalog) exclude-from-search (exclude-from-search) featured (featured) outofstock (outofstock) rated-1 (rated-1) rated-2 (rated-2) rated-3 (rated-3) rated-4 (rated-4) rated-5 (rated-5) ### Theme ### Name: This is custom theme WooCommerce Support: ? ### Templates ### Overrides: – ### Action Scheduler ### Zakończ: 109 Oldest: 2021-12-06 18:39:58 +0100 Newest: 2021-12-26 19:19:03 +0100 ### Status report information ### Generated at: 2022-01-04 07:40:23 +01:00
Can try the pointers provided in this stack exchange?
This
stack exchange
topic deals with encoding problems in the database, not the CLI. My database has the correct encoding. Note that if I use the--format
flag withcsv
instead ofjson
, it works fine- This reply was modified 2 years, 10 months ago by Kris Kelvin.
Hi @kanlukasz,
After checking on Github I noticed that this was labeled as a bug by the developers. Thank you for opening the Github issue. For ease of reference I will post the link below:
https://github.com/woocommerce/woocommerce/issues/31542
Since developers are already working on it and the bug will be fixed within the next releases, I’m going to close the thread now. Feel free to open a new topic if you have any further questions.
Cheers.
- The topic ‘WC CLI list name field to json with special characters’ is closed to new replies.