Comments (3)
I think I've got a similar issue with a fancy quote:
mssql-cli:
DB> select newstitle from hrdb_news where newsidentifier = 'Breeders_Cup_winner_Whitmore_sprints_to_8_year_old_campaign_123';
+--------------------------------------------------------------+
| newstitle |
|--------------------------------------------------------------|
| Breeders’ Cup winner Whitmore sprints to 8-year-old campaign |
+--------------------------------------------------------------+
(1 row affected)
Time: 0.355s
DB> select master.dbo.fn_varbintohexstr(cast(newstitle as varbinary(max))) from hrdb_news where newsidentifier = 'Breeders_Cup_winner_Whitmore_sprints_to_8_year_old_campaign_123';
-[ RECORD 1 ]-------------------------
(No column name) | 0x42007200650065006400650072007300192020004300750070002000770069006e006e0065007200200057006800690074006d006f0072006500200073007000720069006e0074007300200074006f00200038002d0079006500610072002d
(1 row affected)
where the column looks like:
+-----------------------+------------------+------------+----------+--------+---------+------------+----------------------+------------------------+------------------------------+
| Column_name | Type | Computed | Length | Prec | Scale | Nullable | TrimTrailingBlanks | FixedLenNullInSource | Collation |
|-----------------------+------------------+------------+----------+--------+---------+------------+----------------------+------------------------+------------------------------|
| NewsTitle | nvarchar | no | 510 | | | no | (n/a) | (n/a) | SQL_Latin1_General_CP1_CI_AS |
but Tds gives me:
iex(2)> IO.inspect(a.news_title, binaries: :as_strings)
"Breeders\x19 Cup winner Whitmore sprints to 8-year-old campaign"
<<66, 114, 101, 101, 100, 101, 114, 115, 25, 32, 32, 67, 117, 112, 32, 119, 105,
110, 110, 101, 114, 32, 87, 104, 105, 116, 109, 111, 114, 101, 32, 115, 112,
114, 105, 110, 116, 115, 32, 116, 111, 32, 56, 45, 121, 101, 97, 114, 45, 111,
...>>
with ecto schema:
schema "hrdb_News" do
field(:news_title, :string)
from tds.
My issue was solved by setting up :tds_encoding
per the instructions in the README.
from tds.
With erlang builtin :unicode module there is not higher compatibility between latin1 encoding and SQL_Latin1_General_CP1_CI_AS collation since some stuff is sent as ucs2 string. This ucs2 is NOT! UTF-16 nor UTF-8, ucs2 is fixed char code length (always 2 or 4 bytes long) while UTF-X is variable in char code length. If you need to store anything that has chars codes that contain higher byte other than zero you should use :tds_encoding lib
from tds.
Related Issues (20)
- Getting MatchError even when passing correct credential HOT 10
- Ecto.Adapters.SQL.query/4 does not set correct type for parameters. HOT 7
- Need help with output parameter - SQL Server 2016 HOT 2
- Federated Auth HOT 3
- Implicit conversion from data type varbinary to date is not allowed HOT 18
- Current Status of this project? HOT 19
- Pull ntlm_auth to master HOT 3
- Support for Table Value Parameters in Tds adapter HOT 3
- Casting to nvarchar(max) returns nil results. HOT 4
- TLS connection error with OTP 25 HOT 5
- Image type support? HOT 9
- FunctionClauseError following a connection redirect HOT 3
- Azure Sql Database error NXDOMAIN HOT 1
- Bureaucracy HOT 2
- Geometry column type support HOT 8
- Connect to SQL server over TCP HOT 4
- Azure Redirect TCP connection closes every 2 minutes HOT 5
- Error connecting to local MSSQL database
- TDS and query prefixes to access several databases inside MSSQL HOT 1
- Ecto queries timeout when using the Ecto.Adapters.Tds adapter to query 10000 rows with columns of floating point numbers HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tds.