Temat: C# zamiana z mozavia na utf8
kurcze, coś takiego:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Collections;
namespace ConsoleApplication1
{
class Program
{
private string EncodeUnicodeFechedFromCP852ToCP620(string input)
{
string output = input;
output = output.Replace((char)0x00A4, (char)0x2567);
output = output.Replace((char)0x00A7, (char)0x2321);
output = output.Replace((char)0x00A8, (char)0x2219);
output = output.Replace((char)0x00AD, (char)0x2261);
output = output.Replace((char)0x00B4, (char)0x2229);
output = output.Replace((char)0x00B8, (char)0x2248);
output = output.Replace((char)0x00C1, (char)0x2561);
output = output.Replace((char)0x00C2, (char)0x2562);
output = output.Replace((char)0x0118, (char)0x00BF);
output = output.Replace((char)0x00C9, (char)0x0118);
output = output.Replace((char)0x00CB, (char)0x2559);
output = output.Replace((char)0x00CD, (char)0x2553);
output = output.Replace((char)0x00CE, (char)0x256B);
output = output.Replace((char)0x00D3, (char)0x03B1);
output = output.Replace((char)0x00D4, (char)0x0393);
output = output.Replace((char)0x015A, (char)0x00F9);
output = output.Replace((char)0x015B, (char)0x015A);
output = output.Replace((char)0x00D7, (char)0x015B);
output = output.Replace((char)0x00DA, (char)0x0398);
output = output.Replace((char)0x00DD, (char)0x03C6);
output = output.Replace((char)0x0143, (char)0x03C0);
output = output.Replace((char)0x0105, (char)0x0143);
output = output.Replace((char)0x0107, (char)0x0105);
output = output.Replace((char)0x0179, (char)0x0107);
output = output.Replace((char)0x00E1, (char)0x0179);
output = output.Replace((char)0x017B, (char)0x255C);
output = output.Replace((char)0x00ED, (char)0x017B);
output = output.Replace((char)0x00FA, (char)0x00D3);
output = output.Replace((char)0x00FD, (char)0x221E);
output = output.Replace((char)0x0102, (char)0x255E);
output = output.Replace((char)0x0103, (char)0x255F);
output = output.Replace((char)0x0144, (char)0x03A3);
output = output.Replace((char)0x0104, (char)0x0144);
output = output.Replace((char)0x0106, (char)0x0104);
output = output.Replace((char)0x010C, (char)0x00BC);
output = output.Replace((char)0x010D, (char)0x0192);
output = output.Replace((char)0x010E, (char)0x2565);
output = output.Replace((char)0x010F, (char)0x2558);
output = output.Replace((char)0x0110, (char)0x2564);
output = output.Replace((char)0x0111, (char)0x2568);
output = output.Replace((char)0x0119, (char)0x2310);
output = output.Replace((char)0x011A, (char)0x2556);
output = output.Replace((char)0x011B, (char)0x256A);
output = output.Replace((char)0x0139, (char)0x0119);
output = output.Replace((char)0x0142, (char)0x00EA);
output = output.Replace((char)0x013A, (char)0x0142);
output = output.Replace((char)0x013D, (char)0x0106);
output = output.Replace((char)0x013E, (char)0x00FB);
output = output.Replace((char)0x0141, (char)0x00A5);
output = output.Replace((char)0x0147, (char)0x2552);
output = output.Replace((char)0x0148, (char)0x03C3);
output = output.Replace((char)0x0150, (char)0x00E8);
output = output.Replace((char)0x0151, (char)0x00EF);
output = output.Replace((char)0x0154, (char)0x03A6);
output = output.Replace((char)0x0155, (char)0x03A9);
output = output.Replace((char)0x0158, (char)0x207F);
output = output.Replace((char)0x0159, (char)0x00B2);
output = output.Replace((char)0x015E, (char)0x2555);
output = output.Replace((char)0x015F, (char)0x00A1);
output = output.Replace((char)0x0160, (char)0x00B5);
output = output.Replace((char)0x0161, (char)0x03C4);
output = output.Replace((char)0x0162, (char)0x258C);
output = output.Replace((char)0x0163, (char)0x03B5);
output = output.Replace((char)0x0164, (char)0x00A2);
output = output.Replace((char)0x0165, (char)0x0141);
output = output.Replace((char)0x016E, (char)0x2590);
output = output.Replace((char)0x016F, (char)0x00E0);
output = output.Replace((char)0x0170, (char)0x03B4);
output = output.Replace((char)0x0171, (char)0x221A);
output = output.Replace((char)0x017A, (char)0x00BD);
output = output.Replace((char)0x017C, (char)0x255B);
output = output.Replace((char)0x017D, (char)0x017A);
output = output.Replace((char)0x017E, (char)0x017C);
output = output.Replace((char)0x02C7, (char)0x2264);
output = output.Replace((char)0x02D8, (char)0x2320);
output = output.Replace((char)0x02D9, (char)0x00B7);
output = output.Replace((char)0x02DB, (char)0x2265);
output = output.Replace((char)0x02DD, (char)0x00B1);
return output;
}
static void Main(string[] args)
{
string datatable;
string datatable2;
datatable = System.IO.File.ReadAllText("C:\\Users\\Lukasz\\Desktop\\c#\\ConsoleApplication1\\bin\\Debug\\txt2.txt");
datatable = EncodeUnicodeFechedFromCP852ToCP620(datatable);
Console.WriteLine("abc: ", datatable);
}
}
}
coś takiego?
to mi generuje błąd:
Error 1 An object reference is required for the non-static field, method, or property 'ConsoleApplication1.Program.EncodeUnicodeFechedFromCP852ToCP620(string)' C:\Users\Desktop\c#\ConsoleApplication1\Program.cs 103 25 ConsoleApplication1
:(