immosquare-extensions 0.1.14 → 0.1.15

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e1bac31a6c2a9a5a15dc679176b78175cfc45f206f769e1dfaf651f32c9765a4
4
- data.tar.gz: b46910b5fa67745109a1dfe38b9150797dc8eded7f1f4abc5bee4ee91cb27d84
3
+ metadata.gz: 9eac5ff3164cb73f659292ba3a389b9213f647e5c5c54f9da0c6535ec68ca573
4
+ data.tar.gz: e1bc371e64193f0d4750298aa0c5e18a88827caa5c2d4826885a8caa530f4ccd
5
5
  SHA512:
6
- metadata.gz: 7a991f9a2afa423b7fa4b97cc771b6587a686a2a60ca81ed5bafdf9fc55655433640a118e3d3491400690342450655afac09ee8032e91f21f79e2b7a39d47ffb
7
- data.tar.gz: 81e58a39befe80f489aa89d12589219146558684be06a864ebd3c828824fa895160cc333fa283138d125a227370d0c699fe146483c6db1b51373cf0729bffe0e
6
+ metadata.gz: 734f2700c95e499f2a4fa35f7b7b7fc80f81aac58d5480332db03490919b5cec8fad77355cc9d5014c21b613144eca10981818422420fe64a54dc4ff5bb210ef
7
+ data.tar.gz: a8076f8d899a9fa2bb6b54b09e15c2b6674f59141fc1d4d17e90e481f9de7c362fef9ffa5ebc0b9d7b7c55aeebc28a5ee338c0dad1d5775cfceb7d87a7304297
@@ -33,8 +33,41 @@ class File
33
33
  ## Read the content of the file with the detected encoding,
34
34
  ## falling back to UTF-8 if the detected encoding is empty or invalid.
35
35
  ##============================================================##
36
- detected_encoding = `uchardet #{file_path}`.strip
37
- encoding_to_use = detected_encoding.empty? ? "UTF-8" : "#{detected_encoding}:UTF-8"
36
+ detected_encoding = `uchardet #{file_path}`.strip
37
+ encoding_whitelist = [
38
+ "UTF-8", # Encodage universel pour texte avec ou sans accents
39
+ "Windows-1252", # Utilisé couramment pour les langues occidentales
40
+ "ISO-8859-1", # L'encodage Latin-1, très utilisé en Europe Occidentale
41
+ "Windows-1250", # Europe Centrale et Orientale
42
+ "ISO-8859-2", # Pour les langues d'Europe Centrale
43
+ "Windows-1251", # Cyrillic; utilisé pour le russe, bulgare, serbe cyrillique
44
+ "KOI8-R", # Russe
45
+ "ISO-8859-5", # Encodage cyrillique
46
+ "ISO-8859-7", # Grec
47
+ "Windows-1253", # Grec
48
+ "ISO-8859-9", # Turc
49
+ "Windows-1254", # Turc
50
+ "ISO-8859-15", # Variante de l'ISO-8859-1 qui couvre plus de caractères
51
+ "Windows-1256", # Arabe
52
+ "ISO-8859-6", # Arabe
53
+ "Windows-1255", # Hébreu
54
+ "ISO-8859-8", # Hébreu
55
+ "Big5", # Chinois traditionnel
56
+ "GB2312", # Chinois simplifié
57
+ "Shift_JIS", # Japonais
58
+ "EUC-JP", # Japonais
59
+ "EUC-KR", # Coréen
60
+ "ISO-2022-JP", # Encodage pour le courrier électronique en japonais
61
+ "ISO-2022-KR", # Coréen
62
+ "ISO-2022-CN", # Chinois
63
+ "UTF-16LE", # UTF-16 Little Endian
64
+ "UTF-16BE", # UTF-16 Big Endian
65
+ "UTF-32LE", # UTF-32 Little Endian
66
+ "UTF-32BE" # UTF-32 Big Endian
67
+ ]
68
+
69
+
70
+ encoding_to_use = detected_encoding.empty? || !encoding_whitelist.include?(detected_encoding) ? "UTF-8" : "#{detected_encoding}:UTF-8"
38
71
  content = File.read(file_path, :encoding => encoding_to_use)
39
72
 
40
73
  ##===========================================================================##
@@ -1,3 +1,3 @@
1
1
  module ImmosquareExtensions
2
- VERSION = "0.1.14".freeze
2
+ VERSION = "0.1.15".freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: immosquare-extensions
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.14
4
+ version: 0.1.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - IMMO SQUARE
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-02-06 00:00:00.000000000 Z
11
+ date: 2024-03-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: unicode_utils