Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Fix replays by converting to ASCII
#REQUIRES -Version 2.0
Convert non-ascii files to ascii so that they can be read by the game
When you enter "Replays" from the main menu a file called "" will be populated with data about replays.
In the occurence of unicode or other non-ascii character it will fail to parse data and the replay will not show up in game. The solution is to remove these characters from individual replays in order for them to display properly. The purpose of this script is to automate this process.
This script needs to be put in the Data\Replays folder.
Use at your own risk. Consider backing up you Replays-folder before running.
# Determine path and set location
$scriptpath = $MyInvocation.MyCommand.Path
$dir = Split-Path $scriptpath
Set-Location $dir
# Are we in the right folder?
if(-not(Test-Path -Path .\ {
Read-Host 'Put me in the Replay folder!' | Out-Null
# All replays
$replays = (Get-ChildItem | ?{ $_.PSIsContainer } | % {$_.Name})
# Working replays
[xml]$xml = Get-Content .\
$xml_replays = ($xml.SelectNodes("/Replays/Replay") | % {$_.Filename})
# Loop over replays
# If they do not show up in game, make a backup of the "" file and create a new one.
$i = 0
foreach ($replay in $replays) {
$info = "$replay\"
if ($xml_replays -notcontains $replay -and (Test-Path -Path "$info")) {
# make sure its an individual replay and not a backed up 'Replay'-folder
$single = ([xml] (Get-Content "$info")).Replay
if ($single) {
# if user runs script twice before visiting the Replay menu
if (Test-Path -Path "${info}.bak") { continue }
Move-Item -Path "$info" -Destination "${info}.bak"
Get-Content "${info}.bak" | Out-File -FilePath "$info" -Encoding ASCII
Read-Host "Fixed $i replay(s)" | Out-Null
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.