Ticket #63 (closed defect: fixed)
BlueCloth turns UTF8 into ASCII-8BIT
| Reported by: | Phrogz | Owned by: | deveiant |
|---|---|---|---|
| Milestone: | Bugfixes | Component: | API |
| Version: | 2.0.7 | Severity: | major |
| Keywords: | encoding utf8 | Cc: |
Description (last modified by deveiant) (diff)
C:\>type test_encoding.rb
Encoding.default_external = 'UTF-8'
require 'bluecloth'
utf8 = IO.read('hi.utf8')
out = BlueCloth.new(utf8).to_html
p utf8.bytes.to_a, utf8.encoding, out.encoding,
BlueCloth::VERSION, RUBY_VERSION, RUBY_PLATFORM
C:\>ruby -KU test_encoding.rb
[226, 128, 156, 104, 105, 226, 128, 157]
#<Encoding:UTF-8>
#<Encoding:ASCII-8BIT>
"2.0.5"
"1.9.1"
"i386-mingw32"
This is the pure Ruby version of BlueCloth installed on Windows 7/64-bit.
Change History
comment:2 follow-up: ↓ 3 Changed 2 years ago by deveiant
- Status changed from new to assigned
- Description modified (diff)
I'll add a test case and a fix here shortly. Thanks for the report!
comment:3 in reply to: ↑ 2 Changed 2 years ago by Phrogz
Replying to deveiant:
I'll add a test case and a fix here shortly. Thanks for the report!
Thanks, that would be great. This is currently forcing me to recommend Textile over Markdown for an internal documentation project starting in a few days. (And I fear the adoption may suffer greatly due to the HTML-centric nature of Textile markup.)
comment:4 Changed 2 years ago by deveiant
- Status changed from assigned to closed
- Resolution set to fixed
Fixed in r3Ae04eccd695ee.
comment:5 Changed 2 years ago by deveiant
- Status changed from closed to reopened
- Resolution fixed deleted
comment:6 Changed 2 years ago by deveiant
My fix was causing a segfault, so I'll do a bit more research on how to properly do m17n from the Ruby C API and re-release a fix.
comment:8 Changed 2 years ago by deveiant
- Version changed from 2.0.5 to 2.0.7
I have a good handle on what I need to do from Ruby, but I'm still testing what Discount will actually support. I also need to update to Discount 1.6.2, which was released last week so I'll roll this into that work.
comment:9 Changed 22 months ago by Phrogz
Ping: as I'm coming up on a new release, I'd like to know when this might be fixed to know if I should be re-including BlueCloth support.
comment:10 Changed 17 months ago by styx
As rails 3.0 are out and ruby 1.9.2 should be used this bug became an issue for me (as I in update progress). Looking forward for fix. Thanks.
comment:11 Changed 17 months ago by deveiant
Fixed in r055519ec5f783a48262a58cf6300f27737992f02.
comment:12 Changed 17 months ago by deveiant
- Status changed from reopened to closed
- Resolution set to fixed

Now with formatting. Sorry.
C:\>type test_encoding.rb Encoding.default_external = 'UTF-8' require 'bluecloth' utf8 = IO.read('hi.utf8') out = BlueCloth.new(utf8).to_html p utf8.bytes.to_a, utf8.encoding, out.encoding, BlueCloth::VERSION, RUBY_VERSION, RUBY_PLATFORM C:\>ruby -KU test_encoding.rb [226, 128, 156, 104, 105, 226, 128, 157] #<Encoding:UTF-8> #<Encoding:ASCII-8BIT> "2.0.5" "1.9.1" "i386-mingw32"