I need help with making an API request in Xano

Options

I'm trying to get the data from a file that is currently saved in my Xano database by making an API request. First, I make a query of the database with the files, next I get the file's url. I use the file's url in the API request using the GET method and settings the content-type's charset as "windows-1252" since the file from the database is windows-1252 encoded. The issue I'm facing is that even though I've set up the charset as windows-1252, it still forces the charset as UTF-8, removing all the special characters from my file's content. Have you guys encountered this? If yes, could you please share how you fixed it? Suggestions are highly appreciated as well.
Note: I have used Axios in making this API request as well and gave me the same results.

Tagged:

Answers

  • Chris Coleman
    Chris Coleman Administrator

    ADMIN

    Options

    Hi @chrstnstl. I imagine the problem is getting the file via an API request. What I would recommend trying instead is the following:

    • Retrieve the URL from the database
    • Use a Create File Resource step providing the URL
    • Use a Get File Resource Data to get the data from the file (the file's raw data will be accessible via the .data path of the output variable of this step)

  • chrstnstl
    chrstnstl Member
    Options

    Hi Chris,
    I followed the steps you've provided however I'm still getting missing special characters from the .data path of the output variable. I have tried adding a "convert_encoding" filter however it still gives me the file content with the missing special characters.

  • Ben -5225939
    Options

    Hi @Chris Coleman co you have any further suggestions? We are really puzzled on this one - and it is a critical process we need to get up and running asap.

  • Ray Deck
    Ray Deck Trusted Xano Expert ✭✭✭
    Options

    What happens after these lines? PHP under the covers treats all text as ASCII, which loses resolution when there are high characters (try looking at any other encoding, like JPEG, for an example of this). But as long as it's just shuffling around in memory, the data usually isn't corrupted. It will be when it's transformed or outputted that we have loss.

    If you think it's a product problem, you migth bring to the Xano office hours on Tuesday. Otherwise, it could be solving a tough intersectional problem. We work on weird stuff like this all the time as part of our focus on the hardest 5% on State Change daily office hours.

  • chrstnstl
    chrstnstl Member
    Options

    @Ray Deck The text are ANSI encoded. The special characters get removed. The files need to be strictly ANSI encoded as well so we can't look at any other encodings.