helperdiscord / petitio

An HTTP/S library designed to be simple, fast, and type-strong.
https://helperdiscord.github.io/petitio/
MIT License
44 stars 6 forks source link

Non-alphabetical texts like korean get crashed #10

Closed zero734kr closed 3 years ago

zero734kr commented 3 years ago
# original text:
- 타락한 그림자의 반지
# when petitio parses it:
+ í\x83\x80ë\x9D½í\x95\x9C 그림ì\x9E\x90ì\x9D\x98 ë°\x98ì§\x80

Using petitio v1.1.0

When I request to this url, petitio is returning something like:

{
    "ItemInfo": {
        "AcquisitionInfo": {
            "Acquisition_000": [
                null
            ]
        },
        "BasicInfo": {
            "Tooltip_Item_000": [
                null
            ],
            "categoryName": "<FONT COLOR='#FA5D00'>ì ë¬¼ ë°</FONT>",
            "categoryType": "200",
            "enhance": "false",
            "itemId": "212300022",
            "itemLevel": "ì
                           ì
 ë ë²¨ 960",
            "itemName": "íë 그림ì",
            "maxQualityIndex": "0",
            "minQualityIndex": "0",
            "setItem": "false"
        }
    }
}

but the expected output was:

{
    "ItemInfo": {
        "AcquisitionInfo": {
            "Acquisition_000": [
                null
            ]
        },
        "BasicInfo": {
            "Tooltip_Item_000": [
                null
            ],
            "categoryName": "<FONT COLOR='#FA5D00'>유물 반지</FONT>",
            "categoryType": "200",
            "enhance": "false",
            "itemId": "212300022",
            "itemLevel": "아이템 레벨 960",
            "itemName": "타락한 그림자의 반지",
            "maxQualityIndex": "0",
            "minQualityIndex": "0",
            "setItem": "false"
        }
    }
}

It seems while parsing buffer to json, something is causing to crash non-alphabetical letters like korean.

Code to reproduce:

import fetch from "petitio"

fetch("https://ludy.game.onstove.com:44333/web/ItemDictionary/Select/212300022?_=1617310085179").json().then(console.log)

I'm using nodejs v14.16.0 with linux mint 20.1.

github-actions[bot] commented 3 years ago

:tada: This issue has been resolved in version 1.2.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket: