Commit f615c877bcb36aa2e4bc399545376671b55f167e
1 parent
822c0a50
Exists in
master
and in
4 other branches
fix can not guess problem
Showing
3 changed files
with
3 additions
and
3 deletions
Show diff stats
app/helpers/application_helper.rb
app/helpers/commits_helper.rb
lib/utils.rb
... | ... | @@ -18,13 +18,14 @@ module Utils |
18 | 18 | |
19 | 19 | module CharEncode |
20 | 20 | def encode(string) |
21 | + return '' unless string | |
21 | 22 | cd = CharDet.detect(string) |
22 | 23 | if cd.confidence > 0.6 |
23 | 24 | string.force_encoding(cd.encoding) |
24 | 25 | end |
25 | 26 | string.encode("utf-8", :undef => :replace, :replace => "?", :invalid => :replace) |
26 | 27 | rescue |
27 | - "Invalid code encoding" | |
28 | + "Invalid Encoding" | |
28 | 29 | end |
29 | 30 | end |
30 | 31 | ... | ... |