I get "incompatible character encodings: CP850 and UTF-8" when displaying the Β£ character in my ramaze application

I get "incompatible character encodings: CP850 and UTF-8" when displaying the Β£ character in my ramaze application. How can I get rid of this error? I have a UTF-8 meta tag in my header tag.

This happens when I type Β£ using the keyboard. Take a look.

coding error

I put the following code in my ruby ​​file and did not fix the problem.

 # encoding: UTF-8 Encoding.default_external = 'utf-8' Encoding.default_internal = Encoding::UTF_8 
+7
ruby encoding ramaze
source share
2 answers

Try to get the encoding to see if the problem fixes:

 your_string.force_encoding(::Encoding::UTF_8) 

If so, immerse yourself in your application and indicate that it sets the wrong encoding, where and why.

Perhaps the server / webpage, like the page you serve, is displayed as US-ASCII because of the header. Or the server starts with encoding other than UTF-8. Or something else in this regard. Your script ends with a piece of external data that is not UTF-8.

+4
source share

Windows problem? Try using Iconv:

Iconv.conv('utf-8', "WINDOWS-1253", X)

+1
source share

All Articles