File: fix-encoding-tests.patch

package info (click to toggle)
ruby-html2text 0.4.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,336 kB
  • sloc: ruby: 267; makefile: 8
file content (24 lines) | stat: -rw-r--r-- 839 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
Description: spec: read windows-1252-example.html with explicit encoding conversion
Author: Simon Quigley <tsimonq2@debian.org>
Origin: vendor
Forwarded: not-needed
Last-Update: 2026-02-24
---
This patch header follows DEP-3: https://dep.debian.net/deps/dep3/
--- a/spec/examples_spec.rb
+++ b/spec/examples_spec.rb
@@ -10,7 +10,13 @@ describe Html2Text do
 
     examples.each do |filename|
       context filename.to_s do
-        let(:html) { File.read(filename) }
+        let(:html) do
+          if filename.to_s.include?('windows-1252')
+            File.read(filename, encoding: 'windows-1252:UTF-8')
+          else
+            File.read(filename, encoding: 'UTF-8')
+          end
+        end
         let(:text_file) { filename.sub('.html', '.txt') }
         let(:expected) { Html2Text.fix_newlines(File.read(text_file)) }