[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Varnamproject-discuss] Python bindings for libvarnam
From: |
Navaneeth K N |
Subject: |
Re: [Varnamproject-discuss] Python bindings for libvarnam |
Date: |
Mon, 27 Oct 2014 07:37:26 +0530 |
Hello Sebin,
I think the problem is creating python string from a general pointer reference.
So in that case, python won’t have any idea about the encoding used and it may
be converting the bytes to some default encoding which it uses. `libvarnam`
gives you a char* which is UTF-8 encoded. To solve this, when you create Python
strings from the result varnam gives, you need to somehow force the encoding to
be UTF-8. I am not a python expert, so not sure the python way of doing this.
Take a look at how it is done in Ruby[1].
Thanks for working on the python port.
[1]: https://github.com/varnamproject/libvarnam/blob/master/varnamc#L868
---
Navaneeth
> On 27-Oct-2014, at 12:31 am, Sebin Thomas <address@hidden> wrote:
>
> നമസ്കാരം
>
> SMCയിലൂടെ ആണു വർണത്തെ കുറിച്ച് ഞാനറിയുന്നത് . കഴിഞ്ഞ കുറച്ച് നാളായി വർണത്തിന്
> ഒരു python binding ഉണ്ടാക്കാനുള്ള ശ്രമത്തിലായിരുന്നു. പക്ഷേ ചില പ്രശ്നങ്ങൾ
> കാരണം മുന്നോട്ട് പോകാൻ സാധിക്കുന്നില . pythonൽ അറിവുള്ള ആരേലും ഒന്നു
> സഹായിക്കുമൊ ?
>
> പ്രോജെക്റ്റ് Githubൽ ഹോസ്റ്റ് ചെയ്തിട്ടുണ്ട് [1]. തൽക്കാലം ലിന്ക്സിൽ മാത്രമേ
> നോക്കിയിട്ട്ല്ലു . libvarnam ഇൻസ്റ്റാൾ ചെയ്തെങ്കിൽ മാത്രമേ ഇതു വർക്ക്
> ചെയ്യുള്ളൂ .
>
> ഞാൻ നേരിടുന്ന പ്രശ്നം ഈ[1] കമ്മിറ്റിൽ വിശദമായി എഴുതിയിട്ടുണ്ട് . വർണം
> commandlineൽ നല്ലതുപോലെ നടക്കുന്നുണ്ട് പക്ഷെ python സ്ക്രിപ്റ്റിലുഡെ
> നോക്കുമ്പോൾ garbled text ആണ് കിട്ടുന്നത്.
>
> നന്നി,
> സെബിൻ
> ----
> [1]http://github.com/sebinthomas/pyvarnam/
>
> [2]https://github.com/sebinthomas/pyvarnam/commit/02af766a78f257920bbf985718aaad2cfba17648
>
> PS: കമ്മിറ്റ് മെസ്സേജിൽ റൂബി അനുഭാവികളെ കുറ്റം പറഞ്ഞേക്കുന്നത് അവർക്ക് FFI
> എന്ന ഒരു അടിപൊളി ജെം ഉള്ളത് കൊണ്ടാണ് :)