Export trackname to .txt file without diacritic

You have a question or need an advice about how to do something? Ask it here!
Post Reply
djbony
Posts: 260
Joined: 13 May 2014 08:11
Export trackname to .txt file without diacritic

Post by djbony »

Hello Bernd,
could I send trackname to file without diacritic and only in uppercase?

For example:
trackname: Kryštof - Křídla z mýdla
in .txt: KRYSTOF - KRIDLA Z MYDLA

Uppercase are not important :) Name without diacritic is important for export to RDS or web...

Thanks.
User avatar
radio42
Site Admin
Posts: 8295
Joined: 05 Apr 2012 16:26
Location: Hamburg, Germany
Contact:
Re: Export trackname to .txt file without diacritic

Post by radio42 »

No. Currently the names/titles are exported as is and by default in UTF-8.
I’d assume, that it is the job of the RDS encoder to remove unsupported characters.
djbony
Posts: 260
Joined: 13 May 2014 08:11
Re: Export trackname to .txt file without diacritic

Post by djbony »

Thanks. I solved it by my own program. But, if it could be PF it would be fine :)

Here is code for convert string:

Public Function RemoveDiacritism(ByVal Text As String) As String
Dim stringFormD = Text.Normalize(System.Text.NormalizationForm.FormD)
Dim retVal As New System.Text.StringBuilder()
For index As Integer = 0 To stringFormD.Length - 1
If (System.Globalization.CharUnicodeInfo.GetUnicodeCategory(stringFormD(index)) <> Globalization.UnicodeCategory.NonSpacingMark) Then
retVal.Append(stringFormD(index))
End If
Next
Return retVal.ToString().Normalize(System.Text.NormalizationForm.FormC)
End Function
User avatar
radio42
Site Admin
Posts: 8295
Joined: 05 Apr 2012 16:26
Location: Hamburg, Germany
Contact:
Re: Export trackname to .txt file without diacritic

Post by radio42 »

This is even more elegant:

Code: Select all

string accentedStr = “Kryštof - Křídla z mýdla“;
byte[] tempBytes = System.Text.Encoding.GetEncoding("ISO-8859-8").GetBytes(accentedStr);
string asciiStr = System.Text.Encoding.UTF8.GetString(tempBytes);
So if you have a working solution, why would you use another one?
djbony
Posts: 260
Joined: 13 May 2014 08:11
Re: Export trackname to .txt file without diacritic

Post by djbony »

There is too much application running in the background :) And thanx for your code... Really more elegant!
User avatar
radio42
Site Admin
Posts: 8295
Joined: 05 Apr 2012 16:26
Location: Hamburg, Germany
Contact:
Re: Export trackname to .txt file without diacritic

Post by radio42 »

As said, any RDS encoder should normalize it’s Input. That’s why I see this job not primary one the ProppFrexx side. So please talk to your RDS solution vendor, whythey don‘t normalize the strings.

Furthermore this little conversion doesn’t require a huge background process.

I can put this request on the WishList, but I guess there are many other requests being served first.
djbony
Posts: 260
Joined: 13 May 2014 08:11
Re: Export trackname to .txt file without diacritic

Post by djbony »

Thank you.
djbony
Posts: 260
Joined: 13 May 2014 08:11
Re: Export trackname to .txt file without diacritic

Post by djbony »

Here is my small app for convert text from file to ISO 8859-8... This may help to somebody ;)
For streaming would be fine if the song title was read from a text file...
Attachments
RDS Convert.rar
(58.65 KiB) Downloaded 307 times

Post Reply