Results 1 to 2 of 2

Thread: Multiple languages

  1. #1

    Thread Starter
    Frenzied Member bmahler's Avatar
    Join Date
    Oct 2005
    Location
    Somewhere just west of the Atlantic
    Posts
    1,568

    Multiple languages

    Hello again all, Ok here is my dillemma. I have an application that reads a chat log from memory of a running game and then displays it in a window. What I am curions about is if it is possible to determine the character encoding of the bytes received so that I can determine wheter it is english or japanese. The chat log contains both text formats, but i can only seem to return one or the other. Thanks for any help
    Boooya
    • Visual Studio 2008 Professional
    • Don't forget to use [CODE]your code here[/CODE] when posting code
    • Don't forget to rate helpful posts!
    • If you're question was answered please mark your thread [Resolved]


    Code Contributions:
    PHP
    PHP Image Gallery v1.0PHP Image Gallery v2.0
    VB 2005
    Find Computers on a networkSimple License EncryptionSQL Server Database Access dllUse Reflection to Return Crystal ReportDocumentSilently Print PDFGeneric Xml Serailizer


    Useful Links: (more to come)
    MSDN (The first and foremost)MSDN Design Guidelines API Reference • Inno Setup CompilerInno Setup PreprocessorISTool - Fairly easy to use GUI for creating inno setup projects • Connection StringsNAnt -Automated BuildsCruise Control .NET - Frontend for automated builds

  2. #2
    Banned
    Join Date
    Nov 2005
    Posts
    2,367

    Re: Multiple languages

    Without seeing the difference and just based on encoding, you can determine if it's japanese by checking the unicode value of the text.
    VB Code:
    1. Private byt() As Byte = {56, 0, 57, 0, 67, 0, 13, 0, 74, 81, 75, 81, 76, 81}
    2.  
    3.     Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    4.         Me.RichTextBox1.Text = System.Text.Encoding.Unicode.GetChars(byt)
    5.         For Each chr As Char In Me.RichTextBox1.Text
    6.             JapaneseEnglish(chr)
    7.         Next chr
    8.     End Sub
    9.  
    10.     Private Sub JapaneseEnglish(ByVal chr As Char)
    11.         If System.Text.Encoding.Unicode.GetBytes(chr)(1) = 0 Then
    12.             MessageBox.Show("English")
    13.         Else
    14.             MessageBox.Show("Japanese")
    15.         End If
    16.     End Sub
    This is a very crude way of determining the language, but it will work... You'll also have to take into account that numbers fall on either side of the fence. There's probably more exceptions, but this is one way.

    (Forgive me... The characters are chinese, but I'm not familiar with the language)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width