actually I try to insert Chinese data to sqlite3 from ActionScript3 using CGI webservice script. for inserting English data it's working fine. But when I try to insert Chinese data, the URL goes like this /cgi-bin/reg.cgi?username=%E5%A5%A0%E5%9F%BA%E6%95%88%E6%9E%9C%E5%9B%BE
and python script shows that update Error. I just googled and got a idea to use encodeURIComponent("奠基效果图"); . When I use encodeURIComponenet it's insert data into my database as like this %E5%A5%A0%E5%9F%BA%E6%95%88%E6%9E%9C%E5%9B%BE . And also I tried byteArray.writeUTF("奠基效果图"); , but when use writeUTF() my URL value goes Null. I think I need to use encode UTF-8. But I don't know how to use that on Action Script. kindly some one suggest some idea to solve this problem. thanks in advance.
Do not think about the format which is stored in the Data Base, when you use the encodeURIComponenet(str) for encoding data, you just use decodeURIComponent(rstr) for retrieve from data base. it can retrieve the data with decoded fromat. I think this one helps.
Related
I've stored the following HTML Entity (🌶🌶) in varchar and is calling it from the database. And then using a for block in the HTML.
However, when the page is rendered, it is displayed as 🌶 instead of the red pepper, I was hoping for.
Am wondering how the amp; got inserted.
Want 🌶 but got 🌶
Try marking the output as |safe.
Only do this if the database code is something you control and you know it is actually safe.
Read me here from the Django Docs: https://docs.djangoproject.com/en/3.0/ref/templates/builtins/#std:templatefilter-safe
I've got web-app (jsp) which is using database (mysql). I've put some data into database to test is it work to show in jsp what's in database There was issue with utf-8 characters (polish letters) but i fixed it by adding <parameter-encoding default-charset="UTF-8" /> into glasfish-web.xml. But i still got problem with putting data into database from form. In database instead of polish character i got "?????". I've tried many thinks and nothing Dont reallu now where to look to fixit
ok problem solved I'll put answer for other people having same problem
In jsp where i start my database connection for url="jdbc:mysql://localhost/databasename i changed it into
url="jdbc:mysql://localhost/databasename?useUnicode=true&characterEncoding=UTF-8"
and now everything in database looks like it shoudl
Problem you have faced is that java has escaped the UTF-8 character sequence.
you can use StringEscapeUtils provided by java in order to escape any characters which become ??? or anything else.
try this :
str = org.apache.commons.lang.StringEscapeUtils.unescapeJava(str);
From java
I am using MySQL Workbench (6.2.3) and I am using ExtractValue() to grab data from an XML string. Using code similar to:
Select
Table2.user_id,
ExtractValue(TableName, '//CustomerSource//LeadID') as LeadID.
ExtractValue(TableName, '//CustomerData//City') as City
From
Schema.Tablename,
Schema2.Table2
Where
Tablename.TransactionID = Table2.TransactionID
;
When the output is delivered, all values created using ExtractValue are viewed as BLOB. When viewing these BLOBs in the viewer, the data is correctly displayed.
I have already tried treating BINARY/VARBINARY values as non-binary strings.
Does anyone know a workaround, fix, or reason that these values are displayed as BLOB?
Also, this code works on older MySQL Workbench installations just fine. I would attempt to install an earlier version, but this is for my team at work and it would be easier to just direct them to the most updated install of MySQL Workbench.
Thank you in advance,
I'm not 100% sure what you are really asking, but assume you don't want to show the extracted values as BLOBs. Solution: try casting the result to a varchar.
I am using ColdFusion 10, but this question can be true for any web-application. I am trying to save a set of checkboxes with the same name. When they are posted, the form variable stores them as a comma separated list of IDs. Normally I would receive it as a varchar parameter in a storedprocedure and will parse them in t-sql to get to the individual values and inserting them to a table. I have been using this technique for quite some time.
I just want to check with you guys if there is any newer way of doing this. Basically what I am asking is how do you save a bunch of html checkboxes into a database table elegantly without using some kind of grunt code, like parsing.
I might use listToArray( form.fieldname ) to turn the list into an array, then loop over the array to do inserts.
Probably this will work. First convert to xml and then use xml to insert into table:http://beyondrelational.com/modules/2/blogs/28/posts/10300/xquery-lab-19-how-to-parse-a-delimited-string.aspx
Borland StarTeam seems to store its data as UTF-8 encoded data in VarChar fields. I have an ASP.NET MVC site that returns some custom HTML reports using the StarTeam database, and I would like to find a better solution for getting the correct data, for a rewrite with MVC2.
I tried a few things with Encoding GetBytes and GetString, but I couldn't get it to work (we use mostly Delphi at work); then I figured out a T-SQL function to return a NVarChar from UTF-8 stored in a VarChar, and created new SQL views which return the data as NVarChar, but it's slow.
The actual problem appears like this: “description†instead of “description”, in both SSMS and in a webpage when using Linq2SQL
Is there a way to get the proper data out of these fields using Entity Framework or Linq2SQL?
Well, once you get the data out, you could always try this:
Encoding.UTF8.GetString(Encoding.Default.GetBytes(item.Description))
assuming the field is encoded in the system ANSI page. You might have to create the right encoding with Encoding.GetEncoding() if for some reason it isn't (looked up from DB type, for example).