-
-
Notifications
You must be signed in to change notification settings - Fork 128
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add settings.log.recode and settings.log.recode.encoding. Fixes: #3231
- Loading branch information
Showing
6 changed files
with
131 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -61,6 +61,7 @@ | |
avi_format | ||
biquad_filter | ||
blank | ||
charset_base | ||
charset | ||
child_support | ||
chord | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
(***************************************************************************** | ||
Liquidsoap, a programmable audio stream generator. | ||
Copyright 2003-2023 Savonet team | ||
This program is free software; you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation; either version 2 of the License, or | ||
(at your option) any later version. | ||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details, fully stated in the COPYING | ||
file at the root of the liquidsoap distribution. | ||
You should have received a copy of the GNU General Public License | ||
along with this program; if not, write to the Free Software | ||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
*****************************************************************************) | ||
|
||
let conf_charset = | ||
Dtools.Conf.void | ||
~p:(Configure.conf#plug "charset") | ||
"Settings related to charset conversion." | ||
|
||
let conf_path = | ||
Dtools.Conf.string ~p:(conf_charset#plug "path") | ||
~d:(Liquidsoap_paths.camomile_dir ()) | ||
"Directory where charset files are to be found." | ||
|
||
let conf_encoding = | ||
Dtools.Conf.list | ||
~p:(conf_charset#plug "encodings") | ||
~d:["UTF-8"; "ISO-8859-1"; "UTF-16"] | ||
"List of encodings to try for automatic encoding detection." | ||
|
||
module C = CamomileLib.CharEncoding.Configure (struct | ||
let basedir = conf_path#get | ||
let datadir = Filename.concat basedir "database" | ||
let localedir = Filename.concat basedir "locales" | ||
let charmapdir = Filename.concat basedir "charmaps" | ||
let unimapdir = Filename.concat basedir "mappings" | ||
end) | ||
|
||
include C | ||
|
||
exception Unknown_encoding of string | ||
exception Unsupported_encoding of t | ||
|
||
let of_string s = try C.of_name s with Not_found -> raise (Unknown_encoding s) | ||
let to_string = C.name_of | ||
let custom_encoding = ref None | ||
|
||
let automatic_encoding () = | ||
match !custom_encoding with | ||
| Some e -> e | ||
| None -> | ||
let encs = conf_encoding#get in | ||
let e = C.automatic "auto" (List.map of_string encs) C.utf8 in | ||
custom_encoding := Some e; | ||
e |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters