flet icon indicating copy to clipboard operation
flet copied to clipboard

DropDown: Value gives UnicodeDecodeError (Greek Alphabet)

Open Tasos306 opened this issue 3 years ago • 3 comments

Dropdown value with greek characters for the dropdown.Option gives: UnicodeDecodeError: 'utf-8' codec can't decode byte 0xd0 in position 0: invalid continuation byte. This is only applicable for the dropdown value as if I try to receive a value from a Textfield I don't get any errors

`

class WindowsUiCard(UserControl): #Windows Object
    def __init__(self)->None:
        super().__init__()

        self.window_type = Dropdown(label="Τύπος", hint_text="Επιλέξτε μία από τις τρεις κατηγορίες", options = [
                                          dropdown.Option("Aluminum"),    
                                          dropdown.Option("Πλαισιο ξυλου με ενεργειακο υαλοπινακα"),   #Wood frames
                                          dropdown.Option("Πλαισιο PVC με ενεργειακό υαλοπίνακα") ,   #Pvc frames
                                      ],
                                  border_color=colors.BLACK,
                                  color = colors.BLACK,
                                  )
      self.window_btn = FloatingActionButton(text="Υπολογισμός", on_click= self.on_window_calc) #Calculate

  def build(self):
        return .......

def on_window_calc(self, e)-> None: #Calculate window price based on type
    type = self.window_type.value
    print(type)
  `

Tasos306 avatar Sep 09 '22 17:09 Tasos306

I tried the following code on both macOS and web clients and couldn't reproduce the issue:

import logging

import flet
from flet import Dropdown, ElevatedButton, Page, Text, colors, dropdown

#logging.basicConfig(level=logging.DEBUG)


def main(page: Page):
   
    dd = Dropdown(label="Τύπος", hint_text="Επιλέξτε μία από τις τρεις κατηγορίες", options = [
                                          dropdown.Option("Aluminum"),    
                                          dropdown.Option("Πλαισιο ξυλου με ενεργειακο υαλοπινακα"),   #Wood frames
                                          dropdown.Option("Πλαισιο PVC με ενεργειακό υαλοπίνακα") ,   #Pvc frames
                                      ],
                                  border_color=colors.BLACK,
                                  color = colors.BLACK,
                                  )
    def calc_click(e):
        type = dd.value
        print(type)

    page.add(
        dd,
        ElevatedButton("Calculate", on_click=calc_click),
    )


flet.app(target=main)

What OS are you running on? Can you try the code above?

FeodorFitsner avatar Sep 09 '22 18:09 FeodorFitsner

I tried your code and I think I have found the problem. When I run the program from python /.main.py it works fine. When I try to run it with hot-reload using flet main.py this is where the problem appears. I have used all the flet commands but the problem still appears. I don't know if it's a bug or if I'm doing something wrong. I work on Windows 10. Thanks for the fast reply and for your great work with flet.

Tasos306 avatar Sep 10 '22 07:09 Tasos306

Gosh, there is something to do with encoding while running subprocess and grabbing its output and it's especially nasty on Windows. I've tried a few tricks but no avail :(

FeodorFitsner avatar Sep 28 '22 18:09 FeodorFitsner

Related to https://github.com/flet-dev/flet/issues/1000 It looks like I'm about to fix this issue.

FeodorFitsner avatar Feb 08 '23 19:02 FeodorFitsner

You can try the fix with pre-release version of Flet module:

pip install flet --upgrade --pre

Let me know how it worked.

FeodorFitsner avatar Feb 08 '23 19:02 FeodorFitsner

Yes everything works fine now. I had to work with version 0.2.4 because it didn't work but now it's perfect. Thank you very much. I have also made an IntField and a FloatField . You can check at discord in the contribution section. Its a bit hacky but gets the job done. Maybe i can send a pull request if you approved it. Thanks a lot with the greek alphabet. I can now finish and pushlich my app on the microsoft store. By the way great job with flet.

On Wed, Feb 8, 2023 at 9:55 PM Feodor Fitsner @.***> wrote:

You can try the fix with pre-release version of Flet module:

pip install flet --upgrade --pre

Let me know how it worked.

— Reply to this email directly, view it on GitHub https://github.com/flet-dev/flet/issues/302#issuecomment-1423162411, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMIOVUVVHAMVBMQXGF66AJ3WWP22XANCNFSM6AAAAAAQI3N74Q . You are receiving this because you authored the thread.Message ID: @.***>

Tasos306 avatar Feb 09 '23 20:02 Tasos306

I can now finish and pushlich my app on the microsoft store.

@Tasos306 How?

ndonkoHenri avatar Feb 10 '23 09:02 ndonkoHenri

It's a bit complicated but I can guide you through. This is the manual process I have found. There is another programmable but i don't know it. First you need to make an account at the Microsoft partner center. (you must pay to be a partner), put your bank information and sign the contract with microsoft. (Be careful in the tax information fields if you are not american) . After you set your account you must have a website because in order to upload your app you must point the user to a url with your policy agreement and your licence agreement about the app. For the licence and the policy you must have a lawyer to guide you through the process (maybe your app has other libraries or dependencies with different licences or if your app collects user information). If your app collects user information you must declare that in the final steps of the upload process (metadata in an xml file). After that, make an executable of your app with pyinstaller (with no console flag). Then use a free program called "Inno setup installer" to make your executable instalable. Then the output off the installable you have to put it in another microsoft free tool called MSIX Packaging Tool (you can find it on the microsoft store for free) to make an msix package. Then run your package with another free microsoft tool called Windows App Center Kit to check for errors. After that you can upload the msix package to the Microsoft Store. Before your app is uploaded, it is checked by the microsoft team and they may ask you questions about what your app does (by email). The process is a bit difficult with all the fields you have to fill, but if you need any help, just let me know. I' be happy to help.

On Fri, Feb 10, 2023 at 11:16 AM TheEthicalBoy @.***> wrote:

I can now finish and pushlich my app on the microsoft store.

@Tasos306 https://github.com/Tasos306 How?

— Reply to this email directly, view it on GitHub https://github.com/flet-dev/flet/issues/302#issuecomment-1425471339, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMIOVUSZYXXFR5437I5QSELWWYBNPANCNFSM6AAAAAAQI3N74Q . You are receiving this because you were mentioned.Message ID: @.***>

Tasos306 avatar Feb 10 '23 15:02 Tasos306

Thanks for the details. I believe you've tried it already..¿ Can I have an app you've made which is in the Ms store already?

ndonkoHenri avatar Feb 10 '23 16:02 ndonkoHenri