Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set default encoding to UTF8 in icecast/shoutcast operators. #2704

Merged
merged 1 commit into from
Oct 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ Changed:

- Switched to `dune` for building the binary and libraries.
- Changed `cry` to be a required dependency.
- Changed default character encoding in `output.harbor`, `output.icecast`
`output.shoutcast` to `UTF-8` (#2704)
- Added support for a Javascript build an interpreter.
- Removed support for `%define` variables, superseded by support for actual
variables in encoders.
Expand Down
11 changes: 5 additions & 6 deletions src/core/outputs/harbor_output.ml
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,8 @@ let proto frame_t =
( "encoding",
Lang.string_t,
Some (Lang.string ""),
Some
"Encoding used to send metadata. If empty, defaults to \
\"ISO-8859-1\" for non-ogg formats and \"UTF-8\" otherwise." );
Some "Encoding used to send metadata. If empty, defaults to \"UTF-8\""
);
("url", Lang.nullable_t Lang.string_t, Some Lang.null, None);
( "metaint",
Lang.int_t,
Expand Down Expand Up @@ -317,10 +316,10 @@ class output p =
let metaint = Lang.to_int (List.assoc "metaint" p) in
let data = encoder_data p in
let encoding = Lang.to_string (List.assoc "encoding" p) in
let recode ~icy m =
let recode m =
let out_enc =
match encoding with
| "" -> if icy then `ISO_8859_1 else `UTF_8
| "" -> `UTF_8
| s -> Charset.of_string (String.uppercase_ascii s)
in
let f = Charset.convert ~target:out_enc in
Expand Down Expand Up @@ -429,7 +428,7 @@ class output p =

method insert_metadata m =
let m = Meta_format.to_metadata m in
let m = recode ~icy:true m in
let m = recode m in
Tutils.mutexify metadata.metadata_m
(fun () -> metadata.metadata <- Some m)
();
Expand Down
5 changes: 2 additions & 3 deletions src/core/outputs/icecast2.ml
Original file line number Diff line number Diff line change
Expand Up @@ -219,8 +219,7 @@ let proto frame_t =
Some Lang.null,
Some
"Encoding used to send metadata and stream info (name, genre and \
description). If null, defaults to \"UTF-8\" for \"http(s)\" \
protocol and \"ISO-8859-1\" for \"icy\" protocol." );
description). If null, defaults to \"UTF-8\"." );
("genre", Lang.nullable_t Lang.string_t, Some Lang.null, None);
( "protocol",
Lang.string_t,
Expand Down Expand Up @@ -340,7 +339,7 @@ class output p =
in
let out_enc =
match s_opt "encoding" with
| None | Some "" -> if protocol = Cry.Icy then `ISO_8859_1 else `UTF_8
| None | Some "" -> `UTF_8
| Some s -> Charset.of_string (String.uppercase_ascii s)
in
let source = Lang.assoc "" 2 p in
Expand Down