ASP.NET Excel export encoding problem

Well I found out that the problem could be in the header of the excel file, that it does not contain the BOM byte sequence (at the beginning of the file representing the encoding used). So I made it this way and it works for me: Response.Clear(); Response.AddHeader(“content-disposition”,”attachment;filename=Test.xls”); Response.ContentType = “application/ms-excel”; Response.ContentEncoding = System.Text.Encoding.Unicode; Response.BinaryWrite(System.Text.Encoding.Unicode.GetPreamble()); … Read more

There is no Unicode byte order mark. Cannot switch to Unicode

The reality of your file’s encoding appears to conflict with that specified by your XML declaration. If your file actually uses one-byte characters, declaring encoding=”utf-16″ won’t change it to use two-byte characters, for example. Try removing the conflicting encoding from the XML declaration. Replace <?xml version=”1.0″ encoding=”utf-16″?> with <?xml version=”1.0″?> You may also be able … Read more

‘git log’ output encoding issues in Windows 10 CLI terminal

Okay, I experimented a bit and found out that Windows Git commands actually need UNIX variables like LC_ALL in order to display Polish (or other UTF-8 characters) correctly. Just try this command: set LC_ALL=C.UTF-8 Then enjoy the result. Here is what happened on my console (font “Consolas”, no chcp necessary): Update: Well, in order for … Read more

MySQL: Get character-set of database or table or column?

Here’s how I’d do it – For Schemas (or Databases – they are synonyms): SELECT default_character_set_name FROM information_schema.SCHEMATA WHERE schema_name = “mydatabasename”; For Tables: SELECT CCSA.character_set_name FROM information_schema.`TABLES` T, information_schema.`COLLATION_CHARACTER_SET_APPLICABILITY` CCSA WHERE CCSA.collation_name = T.table_collation AND T.table_schema = “mydatabasename” AND T.table_name = “tablename”; For Columns: SELECT character_set_name FROM information_schema.`COLUMNS` WHERE table_schema = “mydatabasename” AND table_name … Read more

How to type a new line character in SQL Server Management Studio

You can’t. (Edit: other good answers have been posted with some workable methods.) My preferred method to do this is via a direct SQL update. Two general techniques: –Literal returns inside strings UPDATE mytable SET textvalue=”This text can include line breaks” WHERE rowid = 1234 –Concatenating CHAR codes UPDATE mytable SET textvalue=”This text” + CHAR(10) … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)