Fix character encoding of Engine::get_copyright_info

(cherry picked from commit 28c163a432)
This commit is contained in:
Nathan Franke 2021-10-13 10:42:41 -05:00 committed by Rémi Verschelde
parent 066f214654
commit 4df2951b5c
No known key found for this signature in database
GPG key ID: C3336907360768E1

View file

@ -113,7 +113,7 @@ Dictionary Engine::get_version_info() const {
static Array array_from_info(const char *const *info_list) { static Array array_from_info(const char *const *info_list) {
Array arr; Array arr;
for (int i = 0; info_list[i] != nullptr; i++) { for (int i = 0; info_list[i] != nullptr; i++) {
arr.push_back(info_list[i]); arr.push_back(String::utf8(info_list[i]));
} }
return arr; return arr;
} }
@ -121,7 +121,7 @@ static Array array_from_info(const char *const *info_list) {
static Array array_from_info_count(const char *const *info_list, int info_count) { static Array array_from_info_count(const char *const *info_list, int info_count) {
Array arr; Array arr;
for (int i = 0; i < info_count; i++) { for (int i = 0; i < info_count; i++) {
arr.push_back(info_list[i]); arr.push_back(String::utf8(info_list[i]));
} }
return arr; return arr;
} }
@ -142,14 +142,14 @@ Array Engine::get_copyright_info() const {
for (int component_index = 0; component_index < COPYRIGHT_INFO_COUNT; component_index++) { for (int component_index = 0; component_index < COPYRIGHT_INFO_COUNT; component_index++) {
const ComponentCopyright &cp_info = COPYRIGHT_INFO[component_index]; const ComponentCopyright &cp_info = COPYRIGHT_INFO[component_index];
Dictionary component_dict; Dictionary component_dict;
component_dict["name"] = cp_info.name; component_dict["name"] = String::utf8(cp_info.name);
Array parts; Array parts;
for (int i = 0; i < cp_info.part_count; i++) { for (int i = 0; i < cp_info.part_count; i++) {
const ComponentCopyrightPart &cp_part = cp_info.parts[i]; const ComponentCopyrightPart &cp_part = cp_info.parts[i];
Dictionary part_dict; Dictionary part_dict;
part_dict["files"] = array_from_info_count(cp_part.files, cp_part.file_count); part_dict["files"] = array_from_info_count(cp_part.files, cp_part.file_count);
part_dict["copyright"] = array_from_info_count(cp_part.copyright_statements, cp_part.copyright_count); part_dict["copyright"] = array_from_info_count(cp_part.copyright_statements, cp_part.copyright_count);
part_dict["license"] = cp_part.license; part_dict["license"] = String::utf8(cp_part.license);
parts.push_back(part_dict); parts.push_back(part_dict);
} }
component_dict["parts"] = parts; component_dict["parts"] = parts;