Hi, I am carrying out my first project, one element of which is to transfer data from a csv file to a sharpoint list. The whole process works, however I am stuck with a problem with special characters. I have read that this is a known problem with UTF-8, but I don't really know how to implement it.
Currently the csv file as I open in notepad I see all values correctly, but at the InputToString
base64ToString(triggerBody()?[‘file’][‘contentBytes’]
stage I already have error stamps. I have read to apply this
concat(decodeUriComponent('%EF%BB%BF'), your_file_content)
, but have no idea how 🙂
I would be grateful for your support!
Thanks
Max
HI @maxon ,
You need to create customer connector or any api to convert your file or you can do manually. Here is c# Azure Function code to convert UTF-8
using System.IO;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Azure.WebJobs;
using Microsoft.Azure.WebJobs.Extensions.Http;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Logging;
using System.Text;
public static class ConvertAnsiToUtf8
{
[FunctionName("ConvertAnsiToUtf8")]
public static async Task<IActionResult> Run(
[HttpTrigger(AuthorizationLevel.Function, "post", Route = null)] HttpRequest req,
ILogger log)
{
string requestBody = await new StreamReader(req.Body, Encoding.GetEncoding("windows-1252")).ReadToEndAsync();
byte[] utf8Bytes = Encoding.UTF8.GetBytes(requestBody);
string utf8String = Encoding.UTF8.GetString(utf8Bytes);
return new OkObjectResult(utf8String);
}
}
Mark as solution if it helps.
Thanks,
Sandeep Mishra
the problem is that csv is saved as ANSI not UTF-8
HI @maxon ,
Make sure your CSV file is saved with UTF-8 encoding.
then use
When a file is created or modified in OneDrive. Use "Get file content". Use compose action to add BOM
concat(decodeUriComponent('%EF%BB%BF'), base64ToString(triggerBody()?['file']['contentBytes']))
then parse CSV and then iterate through the CSV rows and create SharePoint list items.
Mark as solution if it helps.
Thanks,
Sandeep Mishra
Tomac
986
Moderator
stampcoin
699
Super User 2025 Season 2
Riyaz_riz11
577
Super User 2025 Season 2