The database is based on MSSql and Laravel is successfully talking to it. Database is base on latin2 encoding so my Laravel app has to be iso-8859-1 istead UTF-8. Seems like entire laravel is shouting UTF8 though. I can't find anything in config files.
I have changed database encoding in connection string to be lating1 but that still doesn't' change anything.
When an entry is made form VB desktop application (my colleague is working on that) and he saves a £ symbol to the db, it goes there fine, although when I try to read that it gives me � symbol.
On the other hand if from Form::open tag I create an entry in the database the £ gets prefixed with something weird!
Also I have added <meta charset="iso-8859-1"> to the html tag of the website but when i go in firefox to see page info still tells me that the website is in UTF8. I tried changing some of the files to the western encoding (Sublime save as ->with formating) like index.php, routes.php but the website still shows as UTF8...
Any help/ advice will be much appreciated.
To solve this I have done the following:
Changed the form helper /project/vendor/laravel/framework/src/llluminate/Html/FormBuilder.php in line 106
this:
$attributes['accept-charset'] = 'UTF-8';
to:
$attributes['accept-charset'] = 'latin1';
This way all of the forms were imputing to the database right symbols.
After this as my app is not big I have created helper to convert a given string from lating1 to UTF8 like this:
public static function convertToUtf8($string){
return $converted = iconv ('latin1' , 'utf-8' , $string);
}
And it's all working fine :)
Related
I've written a small web-app which pulls data from a simple mysql DB and displays it via Python and Flask. The text fields in the database are encoded as utf8_general_ci, and some contain special characters - for example, 'Zürich'.
As Flask/Jinja2 like to work on unicode, after the query the strings are converted to unicode to be passed into the template. What's weird is I need a different approach to convert to unicode, depending on whether the code is running locally (Mac laptop) or deployed on GAE.
This works when running locally:
return [[unicode(c, encoding='utf-8') if isinstance(c, basestring) else c for c in b] for b in l]
This works when deployed on GAE:
return [[unicode(c, encoding='latin-1') if isinstance(c, basestring) else c for c in b] for b in l]
.
If I run the GAE version locally, 'Zürich' is displayed as 'Zürich'. Vice versa, I get an UnicodeDecode error.
As far as I can tell, the two databases are identical - the online version is a straight dump of the local version.
ü is the Mojibake for ü.
See "Mojibake" in here for a discussion of the likely causes.
See here for Python notes on what to do in the source code. I don't know about Jinja specifics.
I am using
yii\behaviors\SluggableBehavior
In order to transform cyrillic title to converted alias in lattin.
It works nice at my local but When I uploaded the same code into server It doesnt work. It ignores cyrillic chars. It seems problem is not in code because It works nice at local server ( Maybe I need to install some extension for it ?
thanks
I have some words in Devnagri language which I am able to type by setting appropriate font in word.
I want to save data in mysql database.
I set my mysql database to UTF8.
when I copy and paste some string (in same language) from web and insert it into db it works fine.
but when I copy string from word it gives garbage.
I know issue is with encoding but was not able to resolve it.
any guideline is most welcome in this regard.
Word has a lot of stuff underneath that when copied (font size, font family, whether is underline, bold, underlined, etc..) get pasted as "garbage".
To avoid this, copy the text from word, paste it on "notepad" (if you're on windows) or "TextEdit" if you're on Mac (If on mac, make sure to select "Format -> Make Plain text").
Then copy the text from here and paste it on your mysql database.
MS Word seems to be using a proprietary character set, which is incompatible with UTF8. If you really must paste from MS Word, have a look at this page which describes how to export your word document as HTML page with the correct encoding and other options.
http://www.ljmu.ac.uk/ITHelp/webpublishing/118183.htm
Open the generated page or document and try pasting from there.
I'm using SSRS Action -> Go To Url like this:
="javascript:void(window.open('http://xxx/xxx/Pages/ReportViewer.aspx?%2fDevelopment%2fReport&rs:Command=Render&Parameter="& Parameters!Parameter.Value &"'))"
generated link should be:
http://xxx/xx/Pages/ReportViewer.aspx?/Development/Report&rs:Command=Render&Parameter=Úxxx
I need to somehow escape special characters with diacritics like character 'Ú' in example above. Without escaping this character the above link is broken.
Thanks for you help.
You need to URL encode your parameter, however referencing System.Web (as many suggest) is problematic, since later versions of the Reporting Services designer seem to run in a partial trust context, and System.Web does not have APTCA.
Instead, in later framework versions you have the choice of using System.Uri.EscapeDataString or System.Net.WebUtility
See SO question How do you UrlEncode without using System.Web? for examples of both, neither of which require full trust
You need to add Url encoding to your outgoing parameters. This article explains how to reference the library in the report and user UrlEncode() to process your parameters.
I'm developing grails app , connected to MySql database ... I have created database with utf-8 character set and with that collation ... also by default character-set is set to utf-8 on mysql server ... but I defined it explicitly for my schema
In grails app I defined in Datasource.groovy
url = "jdbc:mysql://localhost:3306/blabla?useUnicode=true&characterEncoding=utf-8"
also in Config.groovy
grails.views.gsp.encoding = "UTF-8"
grails.converters.encoding = "UTF-8"
in my .gsp files I added
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
So when I try to create new User via views/user/create.gsp , and in some field I input characters š, č, đ, ć, or ž ... the value inserted in database is something like ÄÄÄ ... but I want the value to be ččč
When I insert new user through SQL statment in MySql Workbench , it is saved as I want it with field value "ččč" , when I load that user on my list.gsp, or show.gsp I can see in browser ččč ...
So the problem is somewhere in the process when saving User via webform...
Can anyone help ?
P.S. I don't know if it is relevant, but when I type these characters in textfield on a webform I switch my keyboard from EN (English) to SR (Serbian Latin) in Language bar in Windows
Grails 1.3.7
STS 2.8.1
mysql-connector-java-5.1.18
Windows 7
I managed to make it work by using <g:uploadForm > tag instead of <g:form> , and within it, regular <g:textfield> for values I wanted to save. Beside that everything else is Grails generated, like DataSource.groovy, Config.groovy, my *.gsp files, like I explained them in question ... Does anyone know difference between these 2 tags?
The issue you are having is caused by a Grails plugin, specifically "webxml" plugin version 1.4.
You need to upgrade that plugin in your project like this:
Stop your Grails application if it's running.
Go to "%USERHOME%.grails\1.3.7\projects\%YOUR_PROJECT%\plugins" folder where %YOUR_PROJECT% is your project's name, and %USERHOME% on Windows 7 is "C:\Users\YOUR_NAME".
There should be a folder named "webxml-1.4". Delete it.
Go to your Grails project folder.
Type "grails install-plugin webxml" and confirm the upgrade to 1.4.1 if asked.
Run your application - non-English letters will now be correctly interpreted even under scaffolding.
Put a <meta charset="utf-8"> tag on your page if you're using HTML5, and set the attribute accept-charset="UTF-8" on your form elements. It seems to be necessary to reliably get your forms submitted in UTF-8 with all browsers.
Run
SET NAMES UTF8
after connect.