Searching for latin/umlaut characters in string

J

John Butler

Hi,

Ive read up a bit about uicode strings and the issues with rails after i
tried to save some data which contained an umlaut character. I got the
following error below when searching for a name that contained the
character é.

Unclosed quotation mark after the character string ')

Is there anyway to search a string for these types of characters and
then ill decide what to do later??

Some sort of string method like scan or include??

JB
 
X

Xavier Noria

T24gVGh1LCBNYXkgMSwgMjAwOCBhdCAxMDo0NSBQTSwgSm9obiBCdXRsZXIgPGpvaG5ueWJ1dGxl
cjdAZ21haWwuY29tPiB3cm90ZToKCj4gIEl2ZSByZWFkIHVwIGEgYml0IGFib3V0IHVpY29kZSBz
dHJpbmdzIGFuZCB0aGUgaXNzdWVzIHdpdGggcmFpbHMgYWZ0ZXIgaQo+ICB0cmllZCB0byBzYXZl
IHNvbWUgZGF0YSB3aGljaCBjb250YWluZWQgYW4gdW1sYXV0IGNoYXJhY3Rlci4gIEkgZ290IHRo
ZQo+ICBmb2xsb3dpbmcgZXJyb3IgYmVsb3cgd2hlbiBzZWFyY2hpbmcgZm9yIGEgbmFtZSB0aGF0
IGNvbnRhaW5lZCB0aGUKPiAgY2hhcmFjdGVyIMOpLgo+Cj4gIFVuY2xvc2VkIHF1b3RhdGlvbiBt
YXJrIGFmdGVyIHRoZSBjaGFyYWN0ZXIgc3RyaW5nICcpCgpTb3VuZHMgbGlrZSBhbiBlbmNvZGlu
ZyBpc3N1ZSB3aXRoIHRoZSBzb3VyY2UgY29kZSBpdHNlbGYuIEFyZSB5b3UKd3JpdGluZyB0aGF0
ICLDqSIgaW4gdGhlIHByb2dyYW0/IElmIHllcywgaXMgeW91ciBlZGl0b3IgY29uZmlndXJlZCB0
bwp3cml0ZSBVVEY4Pwo=
 
J

John Butler

Xavier said:
Sounds like an encoding issue with the source code itself. Are you
writing that "é" in the program? If yes, is your editor configured to
write UTF8?

No the string is coming in via a csv file.
 
7

7stud --

John said:
No the string is coming in via a csv file.


str = "My cafe\xcc\x81 is good."
puts str

if str.include?("cafe\xcc\x81")
puts "yes"
else
puts "no"
end
 
X

Xavier Noria

T24gRnJpLCBNYXkgMiwgMjAwOCBhdCAxMDoxNyBBTSwgSm9obiBCdXRsZXIgPGpvaG5ueWJ1dGxl
cjdAZ21haWwuY29tPiB3cm90ZToKCj4gWGF2aWVyIE5vcmlhIHdyb3RlOgo+Cj4gID4gU291bmRz
IGxpa2UgYW4gZW5jb2RpbmcgaXNzdWUgd2l0aCB0aGUgc291cmNlIGNvZGUgaXRzZWxmLiBBcmUg
eW91Cj4gID4gd3JpdGluZyB0aGF0ICLDqSIgaW4gdGhlIHByb2dyYW0/IElmIHllcywgaXMgeW91
ciBlZGl0b3IgY29uZmlndXJlZCB0bwo+ICA+IHdyaXRlIFVURjg/Cj4KPiAgTm8gdGhlIHN0cmlu
ZyBpcyBjb21pbmcgaW4gdmlhIGEgY3N2IGZpbGUuCgpJcyB0aGUgQ1NWIGZpbGUgaW4gVVRGOD8K
 
J

John Butler

Xavier said:
Is the CSV file in UTF8?

Its Ansii as far as i can tell. Its actually coming from an excel
spread sheet and the user then "saves as" comma separted csv. Then its
import to the application wher i am running into the problem.
 
X

Xavier Noria

T24gRnJpLCBNYXkgMiwgMjAwOCBhdCAyOjUyIFBNLCBKb2huIEJ1dGxlciA8am9obm55YnV0bGVy
N0BnbWFpbC5jb20+IHdyb3RlOgo+Cj4gWGF2aWVyIE5vcmlhIHdyb3RlOgo+ICA+IE9uIEZyaSwg
TWF5IDIsIDIwMDggYXQgMTA6MTcgQU0sIEpvaG4gQnV0bGVyIDxqb2hubnlidXRsZXI3QGdtYWls
LmNvbT4KPiAgPiB3cm90ZToKPiAgPgo+ICA+PiBYYXZpZXIgTm9yaWEgd3JvdGU6Cj4gID4+Cj4g
ID4+ICA+IFNvdW5kcyBsaWtlIGFuIGVuY29kaW5nIGlzc3VlIHdpdGggdGhlIHNvdXJjZSBjb2Rl
IGl0c2VsZi4gQXJlIHlvdQo+ICA+PiAgPiB3cml0aW5nIHRoYXQgIsOpIiBpbiB0aGUgcHJvZ3Jh
bT8gSWYgeWVzLCBpcyB5b3VyIGVkaXRvciBjb25maWd1cmVkIHRvCj4gID4+ICA+IHdyaXRlIFVU
Rjg/Cj4gID4+Cj4gID4+ICBObyB0aGUgc3RyaW5nIGlzIGNvbWluZyBpbiB2aWEgYSBjc3YgZmls
ZS4KPiAgPgo+ICA+IElzIHRoZSBDU1YgZmlsZSBpbiBVVEY4Pwo+Cj4gIEl0cyBBbnNpaSBhcyBm
YXIgYXMgaSBjYW4gdGVsbC4gIEl0cyBhY3R1YWxseSBjb21pbmcgZnJvbSBhbiBleGNlbAo+ICBz
cHJlYWQgc2hlZXQgYW5kIHRoZSB1c2VyIHRoZW4gInNhdmVzIGFzIiBjb21tYSBzZXBhcnRlZCBj
c3YuICBUaGVuIGl0cwo+ICBpbXBvcnQgdG8gdGhlIGFwcGxpY2F0aW9uIHdoZXIgaSBhbSBydW5u
aW5nIGludG8gdGhlIHByb2JsZW0uCgpJZiB0aGUgQ1NWIGlzIEFOU0lJLCBhbmQgdGhlIFJ1Ynkg
c291cmNlIGNvZGUgaXMgQU5TSUksIHdoZXJlIGlzIHRoZQoiw6kiIGNvbWluZyBmcm9tPyA6LSkK
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,226
Members
46,815
Latest member
treekmostly22

Latest Threads

Top