On Jun 23, 2009, at 3:46 PM, Nik wrote:
> > Thanks Phillip for your help! > > I just tried it and it works great! It display that dot thing. But > then because all of my regular expressions did not account for these > characters and some fail at where these characters appear. > > 1 - What do I know even what the right question to ask is... But what > do you call \267 Is this that hex character business or octal, > decimal? It's unicode. A multi-byte, but single character. > And 2 - Just like that character \267 or 'dot' as I call it, how can I > match it? And does it have a class name? By matching the unicode via \267 yourself. This might give some insight... http://interglacial.com/~sburke/tpj/as_html/tpj22.html > Lastly, 3 - and what charcode or other means can I systematically > identify the accentuated characters as in the accent grave in French. If the charcode is over what... 127 then it's not simple ASCII... You might also find this plugin useful - http://github.com/rsl/stringex/tree - It will try and turn all that stuff into simple ASCII. You'll ose the accents, etc, but that might be okay for what you're doing. > Thank You! > > On Jun 23, 4:21 pm, Philip Hallstrom <[email protected]> wrote: >> You could try... >> >> require 'iconv' >> >> clean_str = Iconv.new('UTF-8//Ignore', 'UTF-8').iconv(messy_str) >> >> It doesn't always work though... you might need to catch >> Iconv::InvalidCharacter... >> >> Worth a try though and has gotten me out of some of this mess with >> bad >> source data. >> >> On Jun 23, 2009, at 1:03 PM, Nik wrote: >> >> >> >>> Hello! >> >>> I use MySQL and making sure it is UTF-8 and in my view the character >>> set is also UTF-8. But when I display the text whose input came from >>> either an antiword.exe or WIN32OLE output of a MS Word document in a >>> textarea. Text fail to show immediately after a strange character >>> that >>> shows up in rails console as \267. And I went back to Word to see >>> what >>> this is (looked it up by its position). And it is a dot sort of >>> floating in middle of the line. Sort of like how they display >>> chapters >>> or whatever they call it of the Bible. like 12-7[dot]Matthrew >> >>> For example: >>> Rails Console: >>>>> doc="This is a pipe, but \267 this is not a pipe" >>> HTML: >>> <p> >>> This is a pipe, but >>> </p> >>> It just sort of STOPS rendering the rest of the text. >> >>> I can't possibly ask my clients to remove that so to convenient >>> me. I >>> have been on a 38 hours hunt to try to find some solutions to it. >> >>> Some says remove all [^[:print:]] matches. Which I can do and find a >>> way to at least preserve the \n\r's. But then again, I do want to >>> preserve also as much of the original document as possible. I mean, >>> what if they use umlauts the o with " on top. >> >>> Any ideas? >> >>> Thank You! > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---

