Browse Source

readme GBK编码问题

pull/338/head
xxq250 3 years ago
parent
commit
daf498d6b5
1 changed files with 1 additions and 1 deletions
  1. +1
    -1
      app/helpers/repositories_helper.rb

+ 1
- 1
app/helpers/repositories_helper.rb View File

@@ -115,7 +115,7 @@ module RepositoriesHelper
def new_readme_render_decode64_content(str, owner, repo, ref, readme_path, readme_name)
file_path = readme_path.include?('/') ? readme_path.gsub("/#{readme_name}", '') : readme_path.gsub("#{readme_name}", '')
return nil if str.blank?
content = Base64.decode64(content).force_encoding('UTF-8').valid_encoding? ? Base64.decode64(str).force_encoding('UTF-8') : Base64.decode64(str).force_encoding("GBK").encode("UTF-8")
content = Base64.decode64(str).force_encoding('UTF-8').valid_encoding? ? Base64.decode64(str).force_encoding('UTF-8') : Base64.decode64(str).force_encoding("GBK").encode("UTF-8")
# s_regex = /\s\!\[.*?\]\((.*?)\)\s/
s_regex_c = /`{1,2}[^`](.*?)`{1,2}/
s_regex = /```([\s\S]*?)```[\s]?/


Loading…
Cancel
Save