URL中西里尔字符的JavaScript问题

URL中西里尔字符的JavaScript问题,javascript,reactjs,wordpress,woocommerce,next.js,Javascript,Reactjs,Wordpress,Woocommerce,Next.js,我用nextJS为woocommerce商店制作了一个前端应用程序。因此,我正在构建一个产品页面,该页面的URL中有西里尔字母符号 我正在根据例如example.com/produkt/БПП-ПП-atlanta-1991-grey的查询进行产品请求。我获取slug并将其作为param传递给WooCommerceAPI查询,但始终返回404。我用拉丁字符尝试我的函数,他们的请求没有问题。encodeURIComponent()和decodeURIComponent()但我仍然得到404。我将把

我用nextJS为woocommerce商店制作了一个前端应用程序。因此,我正在构建一个产品页面,该页面的URL中有西里尔字母符号

我正在根据例如example.com/produkt/БПП-ПП-atlanta-1991-grey的查询进行产品请求。我获取slug并将其作为param传递给WooCommerceAPI查询,但始终返回404。我用拉丁字符尝试我的函数,他们的请求没有问题。encodeURIComponent()和decodeURIComponent()但我仍然得到404。我将把我的部分代码粘贴到这里,如果有人给我建议如何修复,我将非常感激

import { withRouter } from "next/router";
import axios from "axios";

const product = ({ slug }) => {
  const [product, setProduct] = useState(undefined);
  const [error, setError] = useState(false);
  const productUrl = `/wp-json/wc/v3/products&slug=${slug}`;
  useEffect(async () => {
    await fetch(baseUrl + productUrl + AUTH_PARAMS).then((res) =>
      console.log(res)
    );
    await axios
      .get(baseUrl + productUrl + AUTH_PARAMS)
      .then((res) => console.log("res", res))
      .catch((err) => console.log("err", err));
  }, [product, error]);

product.getInitialProps = async ({ query }) => {
  const { slug } = query;
  return { slug };
};

export default withRouter(product);
这有用吗?