Welcome Guest, Not a member yet? Register   Sign In
Special character insert into mssql
#1

[eluser]Juzt1s[/eluser]
Hello,

the problem I am facing is that when I insert special characters into mssql server I get
Code:
name ( 1.5 & # 4 1 ; , ie
istead of name (1.5), ie

What do I need to change to get normal values?

sorry for spaces
#2

[eluser]rebornishard[/eluser]
[quote author="Juzt1s" date="1353072947"]Hello,

the problem I am facing is that when I insert special characters into mssql server I get name (1.5), ie istead of name (1.5), ie

What do I need to change to get normal values?[/quote]

try to quote your post and i get (1.5 & # 4 1 ; not (1.5)
what encode you use on mssql ?
#3

[eluser]Juzt1s[/eluser]
I am using:
$db['default']['char_set'] = 'utf8';
$db['default']['dbcollat'] = 'utf8_general_ci';
#4

[eluser]rebornishard[/eluser]
[quote author="Juzt1s" date="1353074321"]I am using:
$db['default']['char_set'] = 'utf8';
$db['default']['dbcollat'] = 'utf8_general_ci';[/quote]
it's mssql right not mysql
mssql use utf16
so
$db['default']['char_set'] = 'utf16';
$db['default']['dbcollat'] = 'utf16_general_ci';

is that work ?
#5

[eluser]Juzt1s[/eluser]
It does not. Still a mess in databse column.

EDIT: I've check my dtabase collation, it's - SQL_Latin1_General_CP1_CI_AS
#6

[eluser]rebornishard[/eluser]
[quote author="Juzt1s" date="1353075356"]It does not. Still a mess in databse column.

EDIT: I've check my dtabase collation, it's - SQL_Latin1_General_CP1_CI_AS[/quote]
it's Latin1 try this
$db[‘default’][‘char_set’] = ‘latin1’;
$db[‘default’][‘dbcollat’] = ‘latin1_general_ci’;
#7

[eluser]Juzt1s[/eluser]
Does not work.
#8

[eluser]Juzt1s[/eluser]
Here is updated and more clear explanation:

The problem I am having is that when I get data out of database everything is fine, but when I write data with special symbols to database I get special symbols coded.

ex. When I write name (1.5), ie I get the name ( 1.5 & # 4 1 ; , ie (without spaces). But when I get from database base everything is fine and name (1.5), ie is shown.

The problem is that my search with special symbols does not work.

here are the configurations. database.config:

Code:
$active_group = 'default';
$active_record = TRUE;

$db['default']['hostname'] = 'xx.xx.x.xxx';
$db['default']['username'] = 'sa';
$db['default']['password'] = 'password';
$db['default']['database'] = 'database';
$db['default']['dbdriver'] = 'mssql';
$db['default']['dbprefix'] = '';
$db['default']['pconnect'] = TRUE;
$db['default']['db_debug'] = FALSE;
$db['default']['cache_on'] = FALSE;
$db['default']['cachedir'] = '';
$db['default']['char_set'] = 'latin1';
$db['default']['dbcollat'] = 'latin1_general_ci';
$db['default']['swap_pre'] = '';
$db['default']['autoinit'] = TRUE;
$db['default']['stricton'] = FALSE;
as you've noticed my database collation is SQL_Latin1_General_CP1_CI_AS.

I've tried setting values to:
Code:
$db[‘default’][‘char_set’] = ‘utf8’;
$db[‘default’][‘dbcollat’] = ‘utf8_general_ci’;

and:
Code:
$db[‘default’][‘char_set’] = ‘utf16’;
$db[‘default’][‘dbcollat’] = ‘utf16_general_ci’;

Any ideas how to write data with special symbols or have my search working. The search is simple, I get string, put it in SQL LIKE statement and return the values.
#9

[eluser]Narf[/eluser]
I suppose you've already read the answer to that question on StackOverflow, but here it is again:

Code:
@ini_set('mssql.charset', 'utf-8');
#10

[eluser]Juzt1s[/eluser]
I did. It works, but when it comes to () the stored value is & # 40; & # 41;





Theme © iAndrew 2016 - Forum software by © MyBB