Jens
June 23, 2021, 3:47am
1
Hello everybody,
What else do I have to add in my code so that the umlauts are retained?
$result = "C:\Users\Jens\Desktop\Schichtenauswertung_EVA\CSVExport\Umwandeln_in_Excel\Schichtenauswertung.csv"
$csvs = get-childItem "C:\Users\Jens\Desktop\Schichtenauswertung_EVA\CSVExport\Schichtenuebesicht\*.csv"
#read and write CSV header
[System.IO.File]::WriteAllLines($result,[System.IO.File]::ReadAllLines($csvs[0])[0])
#read and append file contents minus header
foreach ($csv in $csvs) {
$lines = [System.IO.File]::ReadAllLines($csv)
[System.IO.File]::AppendAllText($result, ($lines[1..$lines.Length] | Out-String))
@Jens Welcome to PowerShell.org forums.
What are umlauts ?. Can you tell a little more on what you are trying to do and post the error if you are getting any.
PS: I’ve formatted the code for you, please use the code symbol on the tool bar while posting the code.
Guide to Posting Code - Redux - PowerShell Help - PowerShell Forums
Olaf
June 23, 2021, 6:24am
3
Jens,
is there a special reason why you’re not using the pure PowerShell way to read and write (CSV) files? … or files in general? Usually it’s easier to maintain German umlauts this way. Import-Csv
and Export-Csv
have the parameter -Encoding
. Provided the value UTF8
usually solves problems with umlauts.
And just to mention it at least once … of course Get-Content
, Set-Content
, Add-Content
and Out-File
offer the same parameter -Encoding
.
@kvprasoon
In linguistics, umlaut (from German "sound alteration") is a sound change in which a vowel is pronounced more like a following vowel or semivowel. The term umlaut was originally coined in connection with the study of Germanic languages, as it had occurred prominently in the history of many of them (see Germanic umlaut). While a common English plural is umlauts, the German plural is Umlaute.
Umlaut is a form of assimilation, the process of one speech sound becoming more similar to a nearby sound....
The Germanic umlaut (sometimes called i-umlaut or i-mutation) is a type of linguistic umlaut in which a back vowel changes to the associated front vowel (fronting) or a front vowel becomes closer to /i/ (raising) when the following syllable contains /i/, /iː/, or /j/.
It took place separately in various Germanic languages starting around AD 450 or 500 and affected all of the early languages except Gothic. An example of the resulting vowel alternation is the English plural foot ~ feet (from Prot...
1 Like