2012-09-29 2 views
2

나는 콘솔에서 영어 필기체를 쓰고 싶다.콘솔에서 영어 필기체를 올바르게 작성하는 방법은 무엇입니까?

디버거에서 나는이 səˈdʒest 이지만 콘솔에는 내가 s??d?est이 있습니다.

이 문제를 해결하는 방법? 감사!

class TranslationFormattedResult 
    { 
     public string Transcription { get; set; } 
     public List<string> TranslatedWordList = new List<string>(); 
    } 
    class TranslatorClient 
    { 
     private TranslationServiceSoapClient _client = new TranslationServiceSoapClient("TranslationServiceSoap"); 

     public async Task<TranslationFormattedResult> GetTranslationAsync(string word) 
     { 
      var result = await _client.GetTranslationAsync("er", "General", 
       word, 
       lang: "ru", 
       limit: 3000, 
       useAutoDetect: true, 
       key: "", 
       ts: "MainSite", 
       tid: ""); 
      var translationResult = new TranslationFormattedResult {Transcription = await GetTranscriptionAsync(result)}; 
      return translationResult; 
     } 

     private async Task<string> GetTranscriptionAsync(TranslationResult result) 
     { 
      var task = new Task<string>(() => 
              { 
               string pr = null; 
               string pattern = "\\[.+\\]"; 
               var match = Regex.Match(result.result, pattern); 
               if(match.Success) 
               { 
                pr = match.Value.Trim('[', ']'); 
               } 
               return pr; 
              }); 
      task.Start(); 
      return await task; 
     } 
    } 

전사

그리고 주요 방법

class Program 
      { 
       static void Main(string[] args) 
       { 
//this works 
        var client = new TranslatorClient();    
      var ts = client.GetTranslationAsync("suggest") 
       .ContinueWith(r => 
            { 
             var transcription = r.Result.Transcription; 
             Console.OutputEncoding = Encoding.Unicode; 
             Console.WriteLine(transcription); 
             Console.WriteLine("press any key"); 
             Console.ReadKey(); 
            } 
        ); 
      ts.Wait(); 
    } 
    } 

text visualizer

+0

. 제대로 표시되는지 확인하려면 콘솔이 아닌 GUI가 있어야합니다. – nhahtdh

+0

몇 가지 코드를 보여줄 수 있습니까? – Thousand

+0

@Thousand 내가 질문을 업데이 트 – BILL

답변

3

당신은해야 참조 :

  1. 는 설정 OutputEncodingUnicode에 : Console.OutputEncoding = Encoding.Unicode;
  2. 은 프로그램을 실행
  3. 콘솔 창을 오른쪽 클릭
  4. 속성 창에서 콘솔 글꼴을 변경하고 Consolas으로 설정하십시오.

class Program { 
    static void Main(string[ ] args) { 
     Console.OutputEncoding = Encoding.Unicode; 
     Console.WriteLine("səˈdʒest"); 
    } 
} 

콘솔의 결과는 다음과 같습니다이 오히려 프로그램보다는 아마 콘솔의 문제

enter image description here

+1

고마워요! 잘 작동합니다! – BILL

+1

@ 빅터 그냥 분명히 당신은이 SO에 대한 의견에 따라 MS의 유니 코드 구현을 조심해야 할 수도 있습니다 답변 : http://stackoverflow.com/questions/388490/unicode-characters-in-windows-command-line-how (권위있는 소스가 참조로 제공되지 않았으므로 신뢰성을 보증 할 수 없습니다. 문제가되는 경우이를주의해서 가져와야합니다.) – Sepster

1

을 얻기를위한

클라이언트까지

이 러시아인가?

그렇다면 chcp 866을 명령 줄에서 실행 해보십시오.

http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/chcp.mspx?mfr=true

이 답변은 또한 특정을 제안 (또는 적어도, 다른()이 러시아에 적용 여부를 확실하지) 글꼴을 선택해야 할 수도 있습니다 Unicode characters in Windows command line - how?

+0

나는 영어 Windows 버전이 있습니다. 모든 인코딩을 사용하려고합니다. 나는 좋은 결과가 없습니다. – BILL

+0

@Victor 명령 줄에서이 명령을 사용 했습니까? 콘솔이 사용할 코드 페이지를 아는 것이 아니라면 응용 프로그램에서 출력되는 내용을 올바르게 표시 할 것이라고 생각하지 않습니다. – Sepster

관련 문제