SongBeamer Forums Forum Index SongBeamer Forums

 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

sng files encoding

 
Post new topic   Reply to topic    SongBeamer Forums Forum Index -> Technical Questions
View previous topic :: View next topic  
Author Message
ycharles



Joined: 03 Aug 2014
Posts: 1

PostPosted: Sun Aug 03, 2014 9:17 pm    Post subject: sng files encoding Reply with quote

Good evening!

We are using SongBeamer to project translations of some songs. As we were collaborating to edit the sng files, we ran into encoding issues in the past (I don't know which version we used at that time, but now, we use v4.28a), as the sng typically contains lyrics in German (with special characters such as , ...), English and French (also special characters such as , , ...)

Now, it seems that we don't have problems anymore, provided that we edit sng files only with songbeamer, and not with another text editor.


I was thinking of writing some kind of script that can extract the song lyrics from the sng file with mixed languages (so it only reads from it), in order to generate for example separated booklets with lyrics in different languages.

My question is, which encoding standard does SongBeamer actually use for sng files? If I open the file in a text editor (e.g. Notepad++), it states that encoding is "ANSI", but if I am not mistaken, pure ANSI does not handle non-English characters.
Characters are correctly read though, and it even looks like SongBeamer can still read it if I modify it with Notepad++ (but for now I don't want to risk it for other files without more testing). But in any case, if I want to read from an sng file with an external script or custom program, it would help me a lot to know how it is encoded.

Thank you very much for your time and attention.
Best regards,

Yannick CHARLES
Back to top
View user's profile Send private message
Sebastian
SongBeamer


Joined: 22 Apr 2006
Posts: 196

PostPosted: Sun Aug 03, 2014 10:35 pm    Post subject: Reply with quote

SongBeamer accepts 4 encodings for sng files: ANSI, UTF-8, Unicode, Big-Endian-Unicode.

When reading a *.sng file, SongBeamer takes a look at the byte order mark (first 2-3 characters of the sng file). This will determine the encoding that is used when reading the file. If there is no byte order mark, then SongBeamer assumes that the file is ANSI with codepage 1252. We don't use heuristics for detecting UTF-8 files as this could lead to unpredictable results.

The byte order mark for UTF-8 is $EF $BB $BF. So if your file starts with these 3 bytes and it is UTF-8 you'll be fine.
Back to top
View user's profile Send private message Send e-mail
phill



Joined: 05 Nov 2017
Posts: 2

PostPosted: Sun Nov 05, 2017 9:24 pm    Post subject: Reply with quote

Hi,

Can you confirm this is still the case, especially with the mac version?
Back to top
View user's profile Send private message
Sebastian
SongBeamer


Joined: 22 Apr 2006
Posts: 196

PostPosted: Fri Nov 17, 2017 11:52 am    Post subject: Reply with quote

That is how it should be according to the specification. If you see any different behaviour, please let us know.
Back to top
View user's profile Send private message Send e-mail
phill



Joined: 05 Nov 2017
Posts: 2

PostPosted: Sun Dec 17, 2017 4:33 am    Post subject: Reply with quote

Thank you for your reply.

Sebastian wrote:
I presume by Unicode & Big-Endian-Unicode you are talking about UTF-16, or perhaps UCS2? Rather than UTF-32?
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    SongBeamer Forums Forum Index -> Technical Questions All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group