harley1387 Posted January 16, 2008 Share Posted January 16, 2008 I'm currently testing an identical file on two servers: Server A: PHP 5.1.4 Server B: PHP 4.3.2 For whatever reason, chr only works on Server A. In Server B, it returns the following character for every value in the array below: � $chars = array( 128 => '€', 130 => '‚', 131 => 'ƒ', 132 => '„', 133 => '…', 134 => '†', 135 => '‡', 136 => 'ˆ', 137 => '‰', 138 => 'Š', 139 => '‹', 140 => 'Œ', 142 => 'Ž', 145 => '‘', 146 => '’', 147 => '“', 148 => '”', 149 => '•', 150 => '–', 151 => '—', 152 => '˜', 153 => '™', 154 => 'š', 155 => '›', 156 => 'œ', 158 => 'ž', 159 => 'Ÿ' ); The PHP manual says that chr works in PHP 4, PHP 5. Any ideas what may causing the problem? Server config? Any help would be greatly appreciated... Link to comment https://forums.phpfreaks.com/topic/86296-chr-function-not-working-in-php-432/ Share on other sites More sharing options...
PFMaBiSmAd Posted January 16, 2008 Share Posted January 16, 2008 chr() is only valid for ASCII characters. ASCII characters are only defined for 0 - 127. Using chr() for values greater than 127 is at your own risk. Link to comment https://forums.phpfreaks.com/topic/86296-chr-function-not-working-in-php-432/#findComment-440876 Share on other sites More sharing options...
harley1387 Posted January 16, 2008 Author Share Posted January 16, 2008 Thanks for the info. I just ran a quick test and sure enough it works for chars below 127 in PHP 4.3.2 on an Apache server. I'm running PHP 5.1.4 locally on my Mac so I'm not sure if that's why the extra characters are supported? Either way, do you have a good workaround for accessing ASCII characters in the 128 - 159 range? I'm trying to replace all the crap MS Word dumps in on a copy/paste to textarea field. Link to comment https://forums.phpfreaks.com/topic/86296-chr-function-not-working-in-php-432/#findComment-440888 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.