File: block-index-from-unicode-data.patch

package info (click to toggle)
ruby-unicode-blocks 1.11.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 144 kB
  • sloc: ruby: 90; makefile: 4
file content (26 lines) | stat: -rw-r--r-- 836 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
Description: generate INDEX from files in unicode-data
  instead of reading binary file, excluded from Debian source
Author: Cédric Boutillier <boutil@debian.org>
Last-Update: 2023-10-14
Bug: https://github.com/janlelis/unicode-blocks/issues/2
Forwarded: no

--- a/lib/unicode/blocks/index.rb
+++ b/lib/unicode/blocks/index.rb
@@ -3,10 +3,12 @@
 
 module Unicode
   module Blocks
-    File.open(INDEX_FILENAME, "rb") do |file|
-      serialized_data = Zlib::GzipReader.new(file).read
-      serialized_data.force_encoding Encoding::BINARY
-      INDEX = Marshal.load(serialized_data)
+    blocks_data = []
+    File.foreach('/usr/share/unicode/Blocks.txt') do |line|
+      if line.match(/^([0-9A-F]+)..([0-9A-F]+); (.*)\n/)
+        blocks_data.append [$1.hex, $2.hex, $3]
+      end
     end
+    INDEX = blocks_data.dup
   end
 end