I have a form that allows people to copy & paste from Excel into a 
textarea. The textarea is then parsed and the data is saved one line at a 
time.

I've noticed a weird issue that I can't seem to resolve to the point I'm 
confident in it's reliability.

When pasting data from excel, where there is an empty cell with a space in 
it, cake appears to be converting that empty cell to the ASCII character 
182 ('A' with circumflex accent) followed by one character of whitespace.

The problem is, I don't believe the conversion is happening exactly as I've 
described. That's what I see when I print the data, however, any attempts 
to use preg_replace or str_replace to strip that character(s) have failed.

The only solution I've been able to find so far is to convert the import 
data to html entities, which converts the offending characters to 
" " and then strip out those using str_replace. However, I'm 
not too confident this won't corrupt other, valid import data that I 
haven't yet considered.

I have not been able to reproduce this problem outside of Cake on the same 
machine. Even with character encoding on the page and accept-encoding attr 
on the form matching Cake's.

Here's how to reproduce the problem:

* Create textarea using cake form helper (nothing non-standard).
* Create excel spreadsheet with 1 empty cell
* In that empty cell, add a space
* Copy that empty cell and paste into the textarea
* Use debug($this->request->data['ModelName']['fieldName']) to print out 
the submitted data.
* You should see a ASCII character 182 followed by a space
* Try and strip that character <-- I haven't been able to do this at all 
without converting using htmlentities

-John

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php

Reply via email to