readme GBK编码问题

This commit is contained in:
xxq250 2023-06-30 14:07:10 +08:00
parent 7e66c13497
commit de095953cc
1 changed files with 1 additions and 1 deletions

View File

@ -208,7 +208,7 @@ module RepositoriesHelper
if is_readme?(entry['type'], entry['name'])
Rails.logger.info("entry===#{entry["type"]} #{entry["name"]}")
content = entry['content'].present? ? entry['content'] : Gitea::Repository::Entries::GetService.call(owner, repo.identifier, URI.escape(entry['path']), ref: ref)['content']
# Rails.logger.info("content===#{content}")
Rails.logger.info("Base64.decode64(content).encoding===#{Base64.decode64(content).encoding}")
return Base64.decode64(content).force_encoding("GBK").encode("UTF-8") if Base64.decode64(content).encoding == Encoding::ASCII_8BIT
return Base64.decode64(content).force_encoding('UTF-8')
else