Search Results

Search found 1003 results on 41 pages for 'utf8'.

Page 19/41 | < Previous Page | 15 16 17 18 19 20 21 22 23 24 25 26  | Next Page >

  • vim unicode bufread/bufwrite script

    - by anon
    Problem: I want my unicode characters to be stored on disk as (rather tan utf8/16 encoding) \u#### However, I want them dispalyed as unicode characters when opened up in vim. I think the easiest way to acheive this is some bufopen/bufwrite script that automatically: on opening, convert \u#### to unicode character on writing, convert unicode characters into \u#### However, I don't know what functions to call to make this happen. Can someone lend a hand? Thanks!

    Read the article

  • [PowerShell] Input encoding

    - by Andy
    Hi! I need to get output of native application under PowerShell. The problem is, output is encoded with UTF-8 (no BOM), which PowerShell does not recognize and just converts those funky UTF chars directly into Unicode. I've found PowerShell has $OutputEncoding variable, but it does not seem to affect input data. Good ol' iconv is of no help either, since this unnecessary UTF8-as-if-ASCII = Unicode conversion takes place before the next pipeline member acquires data.

    Read the article

  • python popen and mysql import

    - by khelll
    I'm doing the following: from subprocess import PIPE from subprocess import Popen file = 'dump.sql.gz' p1 = Popen(["gzip", "-cd" ,file], stdout=PIPE) print "Importing temporary file %s" % file p2 = Popen(["mysql","--default-character-set=utf8", "--user=root" , "--password=something", "--host=localhost", "--port=3306" , 'my_db'],stdin=p1.stdout, stdout=PIPE,stderr=PIPE) err = p1.communicate()[1] if err: print err err = p2.communicate()[1] if err: print err But the db is not being populated. No errors are shown, also I have checked p1.stdout and it has the file contents. Any ideas?

    Read the article

  • How to convert pdf to utf-8

    - by Apple
    I am trying to upload a pdf file using webservice api. But this api doesnot work for pdf file. it works fine for text file.when i try to upload a pdf file it give error as Client-SOAP-ERROR: Encoding: string '%PDF-1.4 %\xc7...' is not a valid utf-8 string So can we convert this pdf file into utf8 string. i am using php as a scripting language.

    Read the article

  • How not to abort http response c#

    - by user194076
    I need to run several methods after sending file to a user for a download. What happens is that after I send a file to a user, response is aborted and I can no longer do anything after response.end(). for example, this is my sample code: Response.Clear(); Response.AddHeader("content-disposition", "attachment; filename=test.pdf"); Response.ContentType = "application/pdf"; byte[] a = System.Text.Encoding.UTF8.GetBytes("test"); Response.BinaryWrite(a); Response.End(); StartNextMethod(); Response.Redirect(URL); So, in this example StartNextMethod and Response.Redirect are not executing. What I tried is I created a separate handler(ashx) with the following code: public void ProcessRequest(HttpContext context) { context.Response.Clear(); context.Response.AddHeader("content-disposition", "attachment; filename=test.pdf"); context.Response.ContentType = "application/pdf"; byte[] a = System.Text.Encoding.UTF8.GetBytes("test"); context.Response.BinaryWrite(a); context.Response.End(); } and call it like this: Download d = new Download(); d.ProcessRequest(HttpContext.Current); StartNextMethod(); Response.Redirect(URL); but the same error happen. I've tryied to replace Response.End with CompleteRequest but it doesn't help. I guess the problem is that I'm using HttpContext.Current but should use a separate response stream. Is that correct? how do I do that in a separate method generically (Assume that I want my handler to accept byte array of data and content type and be downloadable from a separate response. I really do not want to use a separate page for a response. UPDATE I still didn't find a good solution. I'd like to do some actions after user has downloaded a file, but without using a separate page for a response\request thing.

    Read the article

  • Using XmlDiffPatch when writing to stream

    - by Mark Smith
    I am trying to use xmldiffpatch when comparing two Xmls(one from a stream, the other from a file) and writing the diff patch to a stream. The first method is to write my xml to a memory stream. The second method loads an xml from a file and creates a stream for the patched file to be written into. The third method actually compares the two files and writes the third. The xmldiff.Compare(originalFile, finalFile, dgw); method takes (XmlReader, XmlReader, XmlWriter). I'm always getting that both files are identical, even though they are not, so I know that I am missing something. Any help is appreciated! public MemoryStream FirstXml() { string[] names = { "John", "Mohammed", "Marc", "Tamara", "joy" }; MemoryStream ms = new MemoryStream(); XmlTextWriter xtw= new XmlTextWriter(ms, Encoding.UTF8); xtw.WriteStartDocument(); xtw.WriteStartElement("root"); foreach (string s in names) { xtw.WriteStartElement(s); xtw.WriteEndElement(); } xtw.WriteEndElement(); xtw.WriteEndDocument(); return ms; } public Stream SecondXml() { XmlReader finalFile =XmlReader.Create(@"c:\......\something.xml"); MemoryStream ms = FirstXml(); XmlReader originalFile = XmlReader.Create(ms); MemoryStream ms2 = new MemoryStream(); XmlTextWriter dgw = new XmlTextWriter(ms2, Encoding.UTF8); GenerateDiffGram(originalFile, finalFile, dgw); return ms2; } public void GenerateDiffGram(XmlReader originalFile, XmlReader finalFile, XmlWriter dgw) { XmlDiff xmldiff = new XmlDiff(); bool bIdentical = xmldiff.Compare(originalFile, finalFile, dgw); dgw.Close(); StreamReader sr = new StreamReader(SecondXml()); string xmlOutput = sr.ReadToEnd(); if(xmlOutput.Contains("</xd:xmldiff>")) {Console.WriteLine("Xml files are not identical"); Console.Read();} else {Console.WriteLine("Xml files are identical");Console.Read();} }

    Read the article

  • What is the most efficient way to learn x86 assembly?

    - by Web Des
    I want to learn x86 assembly and I want to know if learning reverse engineering is a good way to learn it? Also I have some c++ knowledge of pointers, stack, heap , references, etc.. I was considering this book. http://www.amazon.com/Reversing-Secrets-Engineering-Eldad-Eilam/dp/0764574817/ref=sr_1_1?s=books&ie=UTF8&qid=1340420512&sr=1-1&keywords=reverse+engineering Also Is reverse engineering the same as what they call disassembly?

    Read the article

  • Feedback on Optimizing C# NET Code Block

    - by Brett Powell
    I just spent quite a few hours reading up on TCP servers and my desired protocol I was trying to implement, and finally got everything working great. I noticed the code looks like absolute bollocks (is the the correct usage? Im not a brit) and would like some feedback on optimizing it, mostly for reuse and readability. The packet formats are always int, int, int, string, string. try { BinaryReader reader = new BinaryReader(clientStream); int packetsize = reader.ReadInt32(); int requestid = reader.ReadInt32(); int serverdata = reader.ReadInt32(); Console.WriteLine("Packet Size: {0} RequestID: {1} ServerData: {2}", packetsize, requestid, serverdata); List<byte> str = new List<byte>(); byte nextByte = reader.ReadByte(); while (nextByte != 0) { str.Add(nextByte); nextByte = reader.ReadByte(); } // Password Sent to be Authenticated string string1 = Encoding.UTF8.GetString(str.ToArray()); str.Clear(); nextByte = reader.ReadByte(); while (nextByte != 0) { str.Add(nextByte); nextByte = reader.ReadByte(); } // NULL string string string2 = Encoding.UTF8.GetString(str.ToArray()); Console.WriteLine("String1: {0} String2: {1}", string1, string2); // Reply to Authentication Request MemoryStream stream = new MemoryStream(); BinaryWriter writer = new BinaryWriter(stream); writer.Write((int)(1)); // Packet Size writer.Write((int)(requestid)); // Mirror RequestID if Authenticated, -1 if Failed byte[] buffer = stream.ToArray(); clientStream.Write(buffer, 0, buffer.Length); clientStream.Flush(); } I am going to be dealing with other packet types as well that are formatted the same (int/int/int/str/str), but different values. I could probably create a packet class, but this is a bit outside my scope of knowledge for how to apply it to this scenario. If it makes any difference, this is the Protocol I am implementing. http://developer.valvesoftware.com/wiki/Source_RCON_Protocol

    Read the article

  • [php] mysql and encoding

    - by user339865
    I moved my php application to the new server. i use mysql5 db. When i'm Updating or Inserting something to db, every " and - sign changed to ?. I use SET NAMES UTF8 and SET CHARACTER SET but it don't work. Any ideas?

    Read the article

  • mysql update unique index

    - by atno
    Is there a way to say UPDATE items SET qty=10 WHERE **unique key** instead of saying UPDATE items SET qty=10 WHERE userID=1 AND listID=10 and itemID=100 on the following table? CREATE TABLE IF NOT EXISTS `items` ( `userID` int(20) NOT NULL, `listID` int(20) NOT NULL, `itemID` int(20) NOT NULL, `qty` int(10) NOT NULL, UNIQUE KEY `unique` (`userID`,`listID`,`itemID`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

    Read the article

  • Validate HTML entities in JavaScript

    - by Eduard Luca
    I have a small JavaScript validation script that validates inputs based on Regex. I want to allow certain characters that are not exactly common (not sure if they're UTF8). For example I want to allow the following character ’, which looks like a single quote, but isn't. I got the HTML code for this which is &#8217;, but I'm not sure how to put this into the Regex. I've tried just inputting [&#8217]* but it doesn't validate.

    Read the article

  • MySQL multiple dependent subqueries, painfully slow

    - by matt80
    I have a working query that retrieves the data that I need, but unfortunately it is painfully slow (runs over 3 minutes). I have indexes in place, but I think the problem is the multiple dependent subqueries. I've been trying to rewrite the query using joins but I can't seem to get it to work. Any help would be greatly appreciated. The tables: Basically, I have 2 tables. The first (prices) holds the prices of items in a store. Each row is the price of an item that day, and new rows are added every day with an updated price. The second table (watches_US) holds the item information (name, description, etc). CREATE TABLE `prices` ( `prices_id` int(11) NOT NULL auto_increment, `prices_locale` enum('CA','DE','FR','JP','UK','US') NOT NULL default 'US', `prices_watches_ID` char(10) NOT NULL, `prices_date` datetime NOT NULL, `prices_am` varchar(10) default NULL, `prices_new` varchar(10) default NULL, `prices_used` varchar(10) default NULL, PRIMARY KEY (`prices_id`), KEY `prices_am` (`prices_am`), KEY `prices_locale` (`prices_locale`), KEY `prices_watches_ID` (`prices_watches_ID`), KEY `prices_date` (`prices_date`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=61764 ; CREATE TABLE `watches_US` ( `watches_ID` char(10) NOT NULL, `watches_date_added` datetime NOT NULL, `watches_last_update` datetime default NULL, `watches_title` varchar(255) default NULL, `watches_small_image_height` int(11) default NULL, `watches_small_image_width` int(11) default NULL, `watches_description` text, PRIMARY KEY (`watches_ID`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; The query retrieves the last 10 prices changes over a period of 30 hours, ordered by the size of the price change. So I have subqueries to get the newest price, the oldest price within 30 hours, and then to calculate the price change. Here's the query: SELECT watches_US.*, prices.*, watches_US.watches_ID as current_ID, ( SELECT prices_am FROM prices WHERE prices_watches_ID = current_ID AND prices_locale = 'US' ORDER BY prices_date DESC LIMIT 1 ) as new_price, ( SELECT prices_date FROM prices WHERE prices_watches_ID = current_ID AND prices_locale = 'US' ORDER BY prices_date DESC LIMIT 1 ) as new_price_date, ( SELECT prices_am FROM prices WHERE ( prices_watches_ID = current_ID AND prices_locale = 'US') AND ( prices_date >= DATE_SUB(new_price_date,INTERVAL 30 HOUR) ) ORDER BY prices_date ASC LIMIT 1 ) as old_price, ( SELECT ROUND(((new_price - old_price)/old_price)*100,2) ) as percent_change, ( SELECT (new_price - old_price) ) as absolute_change FROM watches_US LEFT OUTER JOIN prices ON prices.prices_watches_ID = watches_US.watches_ID WHERE ( prices_locale = 'US' ) AND ( prices_am IS NOT NULL ) AND ( prices_am != '' ) HAVING ( old_price IS NOT NULL ) AND ( old_price != 0 ) AND ( old_price != '' ) AND ( absolute_change < 0 ) AND ( prices.prices_date = new_price_date ) ORDER BY absolute_change ASC LIMIT 10 How would I rewrite this to use joins instead, or otherwise optimize this so it doesn't take over 3 minutes to get a result? Any help would be greatly appreciated! Thank you kindly.

    Read the article

  • Why this query is so slow?

    - by Silver Light
    This query appears in mysql slow query log: it takes 11 seconds. INSERT INTO record_visits ( record_id, visit_day ) VALUES ( '567', NOW() ); The table has 501043 records and it's structure looks like this: CREATE TABLE IF NOT EXISTS `record_visits` ( `id` int(11) NOT NULL AUTO_INCREMENT, `record_id` int(11) DEFAULT NULL, `visit_day` date DEFAULT NULL, `visit_cnt` bigint(20) DEFAULT '1', PRIMARY KEY (`id`), UNIQUE KEY `record_id_visit_day` (`record_id`,`visit_day`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 ; What could be wrong? Why this INSERT takes so long?

    Read the article

  • C# save a file from a HTTP Request

    - by d1k_is
    Im trying to download and save a file from a HttpWebResponse but im having problems saving the file (other than Text Files) properly. I think its something to do with this part: byte[] byteArray = Encoding.UTF8.GetBytes(http.Response.Content); MemoryStream stream = new MemoryStream(byteArray); Text Files work fine with the above code but when I try to save the Content to an Image file it gets corrupted. How do i write this 'string' data to an image file (and other binary files)

    Read the article

  • Encoding in SQL to CSV

    - by Z77
    When do I execute query COPY TO ... CSV, I create CSV file. BUt when open it column with names in excel that should be with national characters are not as it should be. So my question is, If it is possible within a sql query to change this encoding to utf8? Or something else? Because I want that new created CSV file to be as final product for user on web. I hope someone understood what I want:)

    Read the article

  • In .NET when I get a response stream from the server what type of encoding type should I use?

    - by Max
    In the following example I m getting a response from the server; however do I need to set ASCII or UTF8 encoding type ? Dim objURI As Uri = New Uri(URL) Dim wReq As WebRequest = WebRequest.Create(objURI) Dim wResp As WebResponse = wReq.GetResponse() Dim respStream As Stream = wResp.GetResponseStream() Dim reader As StreamReader = New StreamReader(respStream, Encoding.ASCII) Dim respHTML As String = reader.ReadToEnd() wResp.Close()

    Read the article

  • How to translate this query:

    - by xRobot
    How can I translate this 2 queries in postgresql ? : . CREATE TABLE example ( id int(10) unsigned NOT NULL auto_increment, from varchar(255) NOT NULL default '0', message text NOT NULL, lastactivity timestamp NULL default '0000-00-00 00:00:00', read int(10) unsigned NOT NULL, PRIMARY KEY (id), KEY from (from) ) DEFAULT CHARSET=utf8; . SELECT * FROM table_1 LEFT OUTER JOIN table_2 ON ( table_1.id = table_2.id ) WHERE (table_1.lastactivity > NOW()-100);

    Read the article

  • Error-invalid length for a base-64 char array

    - by dmenaria
    Hi , I have silverlight app that post some data to another web application ,the data to post is converted to base 64 using code byte[] byteArray = Encoding.UTF8.GetBytes(sDataToPost); sDataToPost = Convert.ToBase64String(byteArray); Another webapplication get the data using the code strText = System.Text.Encoding.ASCII.GetString(System.Convert.FromBase64String(postedData)); But it gives the exception invalid length for a base-64 char array Thanks in Advance DNM

    Read the article

  • How to translate this 2 queries from Mysql to Postgresql? :

    - by xRobot
    How can I translate this 2 queries in postgresql ? : CREATE TABLE `example` ( `id` int(10) unsigned NOT NULL auto_increment, `from` varchar(255) NOT NULL default '0', `message` text NOT NULL, `lastactivity` timestamp NULL default '0000-00-00 00:00:00', `read` int(10) unsigned NOT NULL, PRIMARY KEY (`id`), KEY `from` (`from`) ) DEFAULT CHARSET=utf8; Query: SELECT * FROM table_1 LEFT OUTER JOIN table_2 ON ( table_1.id = table_2.id ) WHERE (table_1.lastactivity > NOW()-100);

    Read the article

  • UnicodeDecodeError in pyton 2.7

    - by user2913962
    i try to write this code to process Arabic language by python import codecs file = codecs.open("C:\Python27\CCA_raw_utf8.txt","r","utf-8") text= file.read() #################################### print "\n "," --------------------------------------------" text=text[1:] words=text.split() for w in words: if w == unicode ("?????","utf-8"): print w but it doesn't and take error " if w == unicode ("?????","utf-8"): UnicodeDecodeError: 'utf8' codec can't decode byte 0xc7 in position 0: invalid continuation byte " why program gives this result and how we can correct that??

    Read the article

< Previous Page | 15 16 17 18 19 20 21 22 23 24 25 26  | Next Page >