|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2000-08-06 20:12 UTC] rasmus@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Nov 04 19:00:02 2025 UTC |
Sybase uses the default character set iso_1, which does not correctly handle (among other things) accentuated spanish characters. If such characters are stored on the database, strange characters or question marks may result. I solved it with the following patch: -+-+-cut from next line. file php3_sybase_charsets.patch-+-+- --- functions/sybase.c.orig Mon Feb 7 23:54:51 2000 +++ functions/sybase.c Sun Aug 6 23:35:07 2000 @@ -260,7 +260,7 @@ static void php3_sybase_do_connect(INTERNAL_FUNCTION_PARAMETERS,int persistent) { - char *user,*passwd,*host; + char *user,*passwd,*host,*charset; char *hashed_details; int hashed_details_length; sybase_link sybase,*sybase_ptr; @@ -322,6 +322,25 @@ sprintf(hashed_details,"sybase_%s_%s_%s",yyhost->value.str.val,yyuser->value.str.val,yypasswd->value.str.val); /* SAFE */ } break; + case 4: { + pval *yyhost,*yyuser,*yypasswd,*yycharset; + + if (getParameters(ht, 4, &yyhost, &yyuser, &yypasswd, &yycharset) == FAILURE) { + RETURN_FALSE; + } + convert_to_string(yyhost); + convert_to_string(yyuser); + convert_to_string(yypasswd); + convert_to_string(yycharset); + host = yyhost->value.str.val; + user = yyuser->value.str.val; + passwd = yypasswd->value.str.val; + charset = yycharset->value.str.val; + hashed_details_length = yyhost->value.str.len+yyuser->value.str.len+yypasswd->value.str.len+yycharset->value.str.len+6+3; + hashed_details = (char *) emalloc(hashed_details_length+1); + sprintf(hashed_details,"sybase_%s_%s_%s_%s",yyhost->value.str.val,yyuser->value.str.val,yypasswd->value.str.val,yycharset->value.str.val); /* SAFE */ + } + break; default: WRONG_PARAM_COUNT; break; @@ -339,6 +358,9 @@ } if (passwd) { DBSETLPWD(sybase.login,passwd); + } + if (charset) { + DBSETLCHARSET(sybase.login,charset); } DBSETLAPP(sybase.login,php3_sybase_module.appname); sybase.valid = 1; -+-+-cut to previous line. file php3_sybase_charsets.patch-+-+- patch with: patch -p0 < php3_sybase_charsets.patch from the php directory (/wherever/php-3.0.16) This will add a fourth parameter to sybase_connect and sybase_pconnect, where one can set the character set desired for the session. I have not tested it on php4, but the code looks similar, so I guess it should work there too.