Bug #6650
closedFixing win32ole test errors
Description
Since FileSystemObject is limited only to ANSI and UTF-16LE encoding tests shouldn't try to use other encodings since they will certainly fail. Instead UTF-16 encoding should be used to check whether writing/reading to/from FSO is properly handled. Attached is a patch that fixes this.
Files
Updated by luislavena (Luis Lavena) over 12 years ago
- Status changed from Open to Assigned
- Target version set to 2.0.0
Updated by luislavena (Luis Lavena) over 12 years ago
- Status changed from Assigned to Closed
- % Done changed from 0 to 100
This issue was solved with changeset r36246.
Boško, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.
- test/win32ole/test_win32ole.rb (test_s_codepage_changed):
FileSystemObject only supports ANSI or UTF-16LE encoding.
Patch by bosko (Bosko Ivanisevic) [ruby-trunk - Bug #6650]
Updated by suke (Masaki Suketa) over 12 years ago
- % Done changed from 100 to 0
I received the following error.
test_s_codepage_changed(TestWin32OLE) [C:/cygwin/home/svn/ruby/test/win32ole/test_win32ole.rb:363]:
<"\xE3\x81\x82"> expected but was
<"\xE3\x81\x81E">.
Finished tests in 53.506664s, 4.1303 tests/s, 12.0359 assertions/s.
221 tests, 644 assertions, 1 failures, 0 errors, 0 skips
ruby -v: ruby 2.0.0dev (2012-06-28 trunk 36246) [i386-mswin32_100]
Updated by luislavena (Luis Lavena) over 12 years ago
- Status changed from Closed to Feedback
suke,
Can you tell us a bit more about WIN32OLE.locale and WIN32OLE.codepage prior running the tests? what is the default locale (chcp)?
These test work under WIN32OLE.codepage 1252 and 65001, so I'm wondering why they are not in your case.
Updated by h.shirosaki (Hiroshi Shirosaki) over 12 years ago
- File 0001-Use-UTF-16-String-instead-of-UTF-8.patch 0001-Use-UTF-16-String-instead-of-UTF-8.patch added
I had same failure on Win7 with chcp 932(default), 1252 and 65001. I guess it depends on Windows system default encoding.
If I change the string from UTF-8 to UTF-16LE, the test works fine for me.
UTF-16LE or ASCII String might be better. I attached the patch.
Updated by luislavena (Luis Lavena) over 12 years ago
h.shirosaki (Hiroshi Shirosaki) wrote:
I had same failure on Win7 with chcp 932(default), 1252 and 65001. I guess it depends on Windows system default encoding.
If I change the string from UTF-8 to UTF-16LE, the test works fine for me.
UTF-16LE or ASCII String might be better. I attached the patch.
Hiroshi, I don't fully follow the rationale in the patch.
You're encoding the string first as UTF-16LE and then force encoding as UTF-16 when sending it to FSO.
AFAIK FSO Only understands ANSI and UTF-16LE.
Also, by doing force_encoding, you're changing test_str to the new encoding and not preserving the original.
I couldn't find WIN32OLE in the list of maintainers, but will be great to hear his comments.
Updated by h.shirosaki (Hiroshi Shirosaki) over 12 years ago
You're encoding the string first as UTF-16LE and then force encoding as UTF-16 when sending it to FSO.
AFAIK FSO Only understands ANSI and UTF-16LE.
Also, by doing force_encoding, you're changing test_str to the new encoding and not preserving the original.
I did force_encoding("UTF-16") because FSO doesn't allow UTF-16LE encoding and an error occurs. Bosko's patch also uses UTF-16 instead of UTF-16LE. force_encoding doesn't change binary representation of test_str.
Updated by luislavena (Luis Lavena) over 12 years ago
- Assignee changed from luislavena (Luis Lavena) to suke (Masaki Suketa)
Masaki,
Can you confirm tests pass after applying Hiroshi's patch?
Thank you.
Updated by luislavena (Luis Lavena) over 12 years ago
Masaki Suketa,
Can you confirm patch from Hiroshi fix the error for you?
Updated by suke (Masaki Suketa) over 12 years ago
- Status changed from Feedback to Closed
- % Done changed from 0 to 100
This issue was solved with changeset r36306.
Boško, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.
- test/win32ole/test_win32ole.rb (test_s_codepage_changed):
FileSystemObject only supports ANSI or UTF-16LE encoding.
Patch by h.shirosaki (Hiroshi Shirosaki) [ruby-trunk - Bug #6650]
Updated by suke (Masaki Suketa) over 12 years ago
On Sat, Jun 30, 2012 at 11:24:03PM +0900, luislavena (Luis Lavena) wrote:
Can you confirm tests pass after applying Hiroshi's patch?
Sorry for being too late to reply.
I confirmed Hiroshi's patch works fine.
Best Regards,
Masaki Suketa