Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

working with Korean #379

Closed
enfshin opened this issue Jan 29, 2023 · 2 comments · Fixed by #393
Closed

working with Korean #379

enfshin opened this issue Jan 29, 2023 · 2 comments · Fixed by #393
Milestone

Comments

@enfshin
Copy link

enfshin commented Jan 29, 2023

Describe the bug
There are times when Korean works well and times when it doesn't. Let me give you an example.

To Reproduce
here is full code that works

import pynecone as pc

class State(pc.State):
    alert_show = False
    alert_text = ""
    notice: str = "공지사항"
    user_id = ""
    user_pw = ""

    def redirect(self):
        return pc.redirect("/about")

    def alert(self):
        self.alert_show = not (self.alert_show)

    def validify_user(self):
        if self.user_id == "":
            print("아이디 입력해주세요.")
            self.alert_text = "아이디를 입력해주세요."
            return self.alert()
        elif self.user_pw == "":
            print("비밀번호를 입력해주세요.")
            self.alert_text = "비밀번호를 입력해주세요."
            return self.alert()
        else:
            return pc.redirect("/about")

def index():
    return pc.vstack(
        ##! 얼럿 컨디션
        pc.cond(
            State.alert_show,
            pc.alert(
                pc.alert_icon(),
                pc.alert_title(
                    State.alert_text
                ),
                status="error",
            ),
            pc.text()
        ),

        pc.box(
            pc.hstack(
                ##! 아이디 비번 인풋
                pc.vstack(
                    pc.input(placeholder="ID", on_change=State.set_user_id),  ## 아이디
                    pc.input(placeholder="PW", type_="password", on_change=State.set_user_pw), ## 비밀번호
                ),
                pc.center(
                    pc.divider(orientation="vertical", border_color="black"),
                    height="6em",
                ),
                ##! 공지사항
                pc.text(State.notice)
            ),
            bg="lightgreen",
            border_radius="15px",
            border_color="green",
            border_width="thick",
            padding=5,
        ),
        pc.button("로그인", on_click=State.validify_user),
    )

def about():
    return pc.vstack(
        pc.text("hello"),

    )


app = pc.App(state=State)
app.add_page(index)
app.add_page(about)
app.compile()

if I change State like this. it doesn't work

class State(pc.State):
    alert_show = False
    alert_text = ""
    notice: str = "공지사항"
    user_id = ""
    user_pw = ""

    def redirect(self):
        # self.reset()
        return pc.redirect("/about")

    def alert(self, msg):
        self.alert_text = msg
        self.alert_show = not (self.alert_show)

    def validify_user(self):
        print(self.user_id, "/", self.user_pw)
        if self.user_id == "":
            print("아이디 입력해주세요.")
            return self.alert("아이디를 입력해주세요.")
        elif self.user_pw == "":
            print("비밀번호를 입력해주세요.")
            return self.alert("비밀번호를 입력해주세요.")
        else:
            return pc.redirect("/about")

Expected behavior
korean alert to show

Screenshots
without "msg" params
20230129_185903

with "msg" params
20230129_190002

** Specifics (please complete the following information):**

  • Python Version: 3.9
  • Pynecone Version: from git
  • OS: widow 10

Additional context
and additional question,
[Grid.js] [ERROR]: Could not determine the storage type
I got above error with NBA example. what would be the reason?

@Lendemor
Copy link
Collaborator

If you print msg within the alert(self, msg) event handler that does not work, I'm expecting you would get something like:

'"your text with the weird display/encoding"'

I've noticed a similar bug before, in #317

@Alek99
Copy link
Member

Alek99 commented Jan 30, 2023

Ok working on this now well get this fixed before the release we are planning on doing tonight

@picklelo picklelo added this to the v0.1.14 milestone Jan 30, 2023
@picklelo picklelo linked a pull request Jan 30, 2023 that will close this issue
11 tasks
@Alek99 Alek99 linked a pull request Jan 30, 2023 that will close this issue
11 tasks
@Alek99 Alek99 removed a link to a pull request Jan 30, 2023
11 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants