I've been messing with this Powershell script (I installed Powershell on my Mac OS)
The program is supposed to return the amount of Japanese characters that show up in a .txt file. I am getting numbers returning instead of actual japanese characters like in the expected screenshot.
None of these .txt files even have a majority of numbers in them.
This is an idea of what I am expecting: Expected outcome
Basically outputting Japanese text characters and how often they show up.
Current output:
My output is shooting me random single letters and numbers instead of Japanese characters like in the expected outcome.
The text file my script is calling from is all Japanese with only a few letters.
Here is my code (I just modified the first line):
$folder = “/Users/mbp/Desktop/nier_unpacked_2_extracted“
$files = gci -recurse $folder | where { ! $_.PSIsContainer }
$fileContents = $files | foreach { gc -encoding utf8 $_.fullname }
$lines = $fileContents | foreach { if ($_ -match "^JP: (.*)$") { $matches[1] } }
$chars = $lines | foreach { $_.ToCharArray() }
$groups = $chars | group-object
$totals = $groups | sort-object -desc -property count
This is the original code(before modification):
$folder = "F:\nier_unpacked_2_extracted"
$files = gci -recurse $folder | where { ! $_.PSIsContainer }
$fileContents = $files | foreach { gc -encoding utf8 $_.fullname }
$lines = $fileContents | foreach { if ($_ -match "^JP: (.*)$") { $matches[1] } }
$chars = $lines | foreach { $_.ToCharArray() }
$groups = $chars | group-object
$totals = $groups | sort-object -desc -property count
Here is the link to the resource i got the code from if that helps: https://dev.to/nyctef/extracting-game-text-from-nier-automata-1gm0