linxGnu / gosmpp

Smpp (3.4) Client Library for Go
Apache License 2.0
152 stars 59 forks source link

data.FindEncoding is not working as intended #21

Closed sujit-baniya closed 4 years ago

sujit-baniya commented 4 years ago

I used following piece of code:

enc := data.FindEncoding("Đừng buồn thế dù ngoài kia vẫn mưa nghiễng rợi tý tỵ")
fmt.Println(enc)

Above code results: &{} instead of actual encoding interface among:

var (
    // GSM7BIT is gsm-7bit encoding.
    GSM7BIT Encoding = &gsm7bit{}

    // ASCII is ascii encoding.
    ASCII Encoding = &ascii{}

    // LATIN1 encoding.
    LATIN1 Encoding = &iso88591{}

    // CYRILLIC encoding.
    CYRILLIC Encoding = &iso88595{}

    // HEBREW encoding.
    HEBREW Encoding = &iso88598{}

    // UCS2 encoding.
    UCS2 Encoding = &ucs2{}
)

Am I missing something?

linxGnu commented 4 years ago

@itsursujit Almost encoding object has no fields, thats why it print &{}.

You could try out:

fmt.Println(enc == data.UCS2) // output: true
linxGnu commented 4 years ago

I will close this issue. Thank you @itsursujit