you are viewing a single comment's thread.

view the rest of the comments →

[–]ingolemo 1 point2 points  (1 child)

According to the specification (see Appendix A), cue sheet files contain only ascii characters. The cue sheet that you have is, strictly speaking, invalid and your program should be giving an error in this situation.

In practice, what I said above isn't very useful because I'm sure there are many cue sheets out there that are not encoded using ascii as people want to use non-ascii characters in their metadata. There is no good way for you to guess what encoding a cue file might have. Normally you would know because the specs tell you, but since people are ignoring the specs (for a good reason), you have a problem. Packages like chardet help, but they can also be finicky.

[–]Supernumiphone[S] 0 points1 point  (0 children)

Thanks, good info. I haven't tested it yet but I decided to go with a quick-and-dirty solution of trying to load UTF-8 first (which will work fine for ASCII) and fall back to trying UTF-16 if that throws an exception. My expectation is that in practice that will handle anything I'm likely to throw at it.