snuk182 / odbc

Automatically exported from code.google.com/p/odbc
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

error in utf16toutf8 #27

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

1. Download and restore Northwind database 
(http://northwinddatabase.codeplex.com/releases/view/71634) in MS SQL Server.
2. Create a folder TestMSSQL, "cd TestMSSQL", put there the attached file, "go 
get", "go build"
3. Run TestMSSQL.exe

What is the expected output? What do you see instead?

Expect: formatted data from Products table

Instead:
--------
panic: runtime error: index out of range

goroutine 1 [running]:
unicode/utf8.EncodeRune(0x20050d80, 0x1, 0x4, 0xe4, 0x20050d80, ...)
        C:/Users/ADMINI~1/AppData/Local/Temp/2/bindist465310315/go/src/pkg/unicode/utf8/utf8.go:339 +0x85
code.google.com/p/odbc.utf16toutf8(0x2008f0c0, 0x13, 0x100000, 0x50, 0x1, ...)
        C:/App/Go/src/code.google.com/p/odbc/utf16.go:49 +0x1f9
code.google.com/p/odbc.(*BaseColumn).Value(0x20089280, 0x2008f0c0, 0x26, 0x52, 
0x48bfe0, ...)
        C:/App/Go/src/code.google.com/p/odbc/column.go:137 +0x66f
code.google.com/p/odbc.(*BindableColumn).Value(0x20078450, 0x1ad2890, 0x1, 
0x48bfe0, 0x16, ...)
        C:/App/Go/src/code.google.com/p/odbc/column.go:239 +0x211
code.google.com/p/odbc.(*Rows).Next(0x200502f8, 0x2007a500, 0xa, 0xa, 0x1, ...)
        C:/App/Go/src/code.google.com/p/odbc/rows.go:34 +0xfe
database/sql.(*Rows).Next(0x20078780, 0x1)
        C:/Users/ADMINI~1/AppData/Local/Temp/2/bindist465310315/go/src/pkg/database/sql/sql.go:1310 +0xb1
main.main()
        C:/App/Go/src/TestMSSQL/main.go:54 +0x403
-------

What version of the product are you using? On what operating system?

Go 1.1.2, Windows 7 (both 32&64)

Please provide any additional information below.

The odbc package fails on fetching unicode string ("Gustaf's Knäckebröd"). 

Original issue reported on code.google.com by ilog2...@gmail.com on 13 Nov 2013 at 10:15

Attachments:

GoogleCodeExporter commented 9 years ago
My silly mistake. Thanks for pointing it out. Here 
https://codereview.appspot.com/26450043/ is a fix. Please, review it, if you 
like.

Thanks again.

Alex

Original comment by alex.bra...@gmail.com on 14 Nov 2013 at 6:17

GoogleCodeExporter commented 9 years ago
Yes, it definitely looks better, thank you. Seems, the conversion to UTF8 was 
rarely used before.

Original comment by ilog2...@gmail.com on 14 Nov 2013 at 8:37

GoogleCodeExporter commented 9 years ago
I am sure people use unicode a lot. This bug is very recent. I doubt many 
people refresh their code.google.com/p/odbc package to the tip often. Lucky, 
you found it quickly :-).

Alex

Original comment by alex.bra...@gmail.com on 14 Nov 2013 at 10:34

GoogleCodeExporter commented 9 years ago
This issue was closed by revision e7603e584cea.

Original comment by alex.bra...@gmail.com on 14 Nov 2013 at 10:35