2

I want to upload files(CSV) to my Azure Storage Account (BlobStorage). The BlobStorage is being observed by an Azure Function (BlobTrigger), which is written in TypeScript. index.ts

const blobTrigger: AzureFunction = async function (context: Context, myBlob: any): Promise<void> {
  console.log(myBlob.toString());
  // result:
  // col11, col12, col13
  // col21, col22, col23
  // col31, col32, col33
  // somecharswith-ä, somecharswith-ö, somecharswith-ü
}

function.json

{
  "bindings": [
    {
      "name": "myBlob",
      "type": "blobTrigger",
      "direction": "in",
      "path": "assets",
      "connection": "dbablobstorage_STORAGE"
    }
  ],
  "scriptFile": "../dist/.../index.js"
}

I would like to use simple operations like split() and foreach to transform the CSV values for insert queries. Unfortunately the umlauts ä, ö, ü gets displayed weirdly. I already tried to use Buffer and utf-8 library to encode the string, but without success.

How I get the strings with well-displayed umlauats? Or is there another recommended way to extract the data from CSV files?

Nico Schuck
  • 832
  • 3
  • 15
  • 32

0 Answers0