# Filepath encoding ANSI UTF-8 question

**URL:** https://community.mp3tag.de/t/filepath-encoding-ansi-utf-8-question/66474
**Category:** Support
**Created:** [November 9, 2024, 9:29am UTC](https://community.mp3tag.de/t/filepath-encoding-ansi-utf-8-question/66474 "2024-11-09T09:29:17Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![mamema](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/m/8baadc/32.png) [@mamema](https://community.mp3tag.de/u/mamema)
#### Post date: [November 9, 2024, 9:29am UTC](https://community.mp3tag.de/t/filepath-encoding-ansi-utf-8-question/66474/1 "2024-11-09T09:29:17Z")

</div>

i'm using the export script to modify timestamps from here:

> [@File-Datum zuweisen / aus Tag generieren](https://community.mp3tag.de/t/file-datum-zuweisen-aus-tag-generieren/15970/4):
>
> ... oh ... zu spät ... aber in diesem Zusammenhang vielleicht doch eine interesssante Alternative, weil anpassbar ... 20120622.SetFileModDateTime.1.0.mte [Neue Aktion: YEAR --\> Dateiänderungsdatum](https://community.mp3tag.de/t/13565/4) DD.20140804.1650.CEST Wenn der Wert von %\_file\_mod\_datetime% im Format "yyyy-mm-dd hh:mm:ss" vorliegt, ... z. B. 2014-05-03 21:44:29, ... dann kann man diesen Wert ohne weitere Bearbeitung in einem VBS Skript anwenden. 20140805.SetFileModDateTime.1.1.mte [Export.VBS.20140805.SetFileModDateTime.1…](https://community.mp3tag.de/uploads/default/original/2X/d/d15751ac12bb829994dfa732f67f5108686a58f7.mte)

(for readers: this sets file modification dates according to a value from a mp3tag tag)

works as expected most of the time.  
But as the export script (needs?) to run with ANSI if have problems with files and paths which have special characters. Those files were of course not found when i execute the generated vb script.

I've tried to convert the vb script with notepad++ to utf-8, but this doesn't cut it.

How would the mp3tag pros tackle this issue?

---

<div class="post-metadata">

### Author: ![ohrenkino](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ohrenkino/32/4843_2.png) [@ohrenkino](https://community.mp3tag.de/u/ohrenkino)
#### Post date: [November 9, 2024, 9:32am UTC](https://community.mp3tag.de/t/filepath-encoding-ansi-utf-8-question/66474/2 "2024-11-09T09:32:10Z")

</div>

> [@mamema](#):
>
> But as the export script (needs?) to run with ANSI

Where does this requirement come from?

You can set the character encoding for the export script output as documented:

> **[Exporting Tag and File Information – Mp3tag Documentation](https://docs.mp3tag.de/export/#export-scripting-functions)**
>
> Documentation on exporting tag and file information to text-based file formats. Mp3tag is the universal Tag Editor.

---

<div class="post-metadata">

### Author: ![mamema](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/m/8baadc/32.png) [@mamema](https://community.mp3tag.de/u/mamema)
#### Post date: [November 9, 2024, 9:35am UTC](https://community.mp3tag.de/t/filepath-encoding-ansi-utf-8-question/66474/3 "2024-11-09T09:35:55Z")

</div>

the first line of the export.mte is:  
$filename($getEnv('USERPROFILE')'\Desktop\SetFileModDateTime.vbs',ANSI)

runs fine as i said

as soon as i change this to:  
$filename($getEnv('USERPROFILE')'\Desktop\SetFileModDateTime.vbs',utf-8)

it errors out with a wscript error: invalid char in line 1 when i execute the generated vbscript.

because of that i thought it's a requirement. I'm not a vbscript pro

---

<div class="post-metadata">

### Author: ![ohrenkino](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ohrenkino/32/4843_2.png) [@ohrenkino](https://community.mp3tag.de/u/ohrenkino)
#### Post date: [November 9, 2024, 9:47am UTC](https://community.mp3tag.de/t/filepath-encoding-ansi-utf-8-question/66474/4 "2024-11-09T09:47:40Z")

</div>

I do not get an error if I generate the export in UTF-8 but without writing the BOM.  
See the Options\>Export.

---

<div class="post-metadata">

### Author: ![mamema](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/m/8baadc/32.png) [@mamema](https://community.mp3tag.de/u/mamema)
#### Post date: [November 9, 2024, 10:39am UTC](https://community.mp3tag.de/t/filepath-encoding-ansi-utf-8-question/66474/5 "2024-11-09T10:39:30Z")

</div>

i also didn't get it when BOM is disabled. But now i get "file not found" (the ones created through this export.)  
Unfortunately the line number for the error is not the file which isn't found but instead the line of the function which should set it:

Set objFile = objFSO.GetFile(strMp3tagPath)

but doesn't matter, i've checked it, it errors out on every file, so here one for example:

\Adam Bałdych & Helge Lien Trio\Bridges.flac

look at the "l" in "Baldych" this is the culprit it guess....

i can cd to the folder/file within a dos prompt. Dunno why the script errors out.

---

<div class="post-metadata">

### Author: ![ohrenkino](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ohrenkino/32/4843_2.png) [@ohrenkino](https://community.mp3tag.de/u/ohrenkino)
#### Post date: [November 9, 2024, 11:10am UTC](https://community.mp3tag.de/t/filepath-encoding-ansi-utf-8-question/66474/6 "2024-11-09T11:10:53Z")

</div>

You can edit the script with a plain text editor and check if the generated path is actually readable.

---

<div class="post-metadata">

### Author: ![mamema](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/m/8baadc/32.png) [@mamema](https://community.mp3tag.de/u/mamema)
#### Post date: [November 9, 2024, 11:13am UTC](https://community.mp3tag.de/t/filepath-encoding-ansi-utf-8-question/66474/7 "2024-11-09T11:13:36Z")

</div>

as i said, the actual line is:

"M:\Adam Bałdych & Helge Lien Trio\Bridges [24 Bit]\02 - Polesie.flac"

if i cut'n paste the path into a dos window it is accesible

---

<div class="post-metadata">

### Author: ![mamema](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/m/8baadc/32.png) [@mamema](https://community.mp3tag.de/u/mamema)
#### Post date: [November 9, 2024, 11:48am UTC](https://community.mp3tag.de/t/filepath-encoding-ansi-utf-8-question/66474/9 "2024-11-09T11:48:06Z")

</div>

solved it. In another forum i've found the info, that vb scripts cannot run with utf-8 correctly. It needs to be utf-16.  
This solved it!  
Now running fine.

---

<div class="post-metadata">

### Author: ![system](https://community.mp3tag.de/uploads/default/original/2X/c/ce7035d426cb755a7916793326d23b465222a407.png) [@system](https://community.mp3tag.de/u/system)
#### Post date: [December 9, 2024, 11:48am UTC](https://community.mp3tag.de/t/filepath-encoding-ansi-utf-8-question/66474/10 "2024-12-09T11:48:07Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
