• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Character Encoding

I am not sure if this is a PHP question or a CI question.

I am building an app that has MSSQL as the backend. I am pulling a uniqueid field from a table to use as a value in a cookie

The value in my table is this:


The value displayed in the page I am using to test the value is this (with UTF-8 encoding):


The value in the cookie as passed to the browser with the helper function set_cookie() is:


I would like to be able to test the cookie on subsequent page loads for permissions and so forth. Apart from using session id's is there something in CI that I can use to make the table value show in my page and "Set" in my cookie consistent with the value displayed in my backend or is this a browser issue that I will need to play with?


Addendum: I believe the encoding is happening within the PHP query process. Retrieving the value and then re-querying the table using the uniqueid as PHP presents it gives me a database error "converting character string to uniqueidentifier." I am going to look for some info on this but if anyone has firsthand knowledge of the issue and can point me to a work around, I would be appreciative.

Addendum 2: Work around is using this in the SELECT statement CAST(myuniqueidentifier_field as VARCHAR(36)) as CGUID. This gives me all the right cookie, html encoding and all the other stuff and works in subsequent queries using the value as the search parameter.

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.