0

我需要缓存一个包含 'ç' 、 'ã' 、 'õ' 等字符的字符串,但它们的格式错误。我已经尝试将字符集更改为 iso-8859-1 并且字符格式仍然错误。

有人能帮我吗 ...

我正在使用的代码是:

const test= `{"test": "ç-ç-ç-ã-ã-ã-õ-â-ô"`;

putCache(`14567`, test);

const putCache = (item, data) => {
   if ('caches' in window) {
    caches.open(DocumentCache).then(cache => {
        cache.put(new Request(item), new Response(data                
            , {
                headers: {                      
                  'Content-Type': 'text/plain;charset=iso-8859-1'
                }}

            ));
    })
  }
}

在此处输入图像描述

4

0 回答 0