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

how to support utf-8 character in yaml file? #19

Open
jjcizi opened this issue Jun 24, 2018 · 3 comments
Open

how to support utf-8 character in yaml file? #19

jjcizi opened this issue Jun 24, 2018 · 3 comments

Comments

@jjcizi
Copy link

jjcizi commented Jun 24, 2018

First, your package is great!
But, your package can not support utf-8 character in yaml file. It means a lot of people cant not use their home language to show results.
Can you fix this? Please.
Or tell me how to solve this problem.

@gluc
Copy link
Owner

gluc commented Jun 24, 2018

Not sure why you believe it doesn't work. Using the the online app at https://ipub.com/dev-corner/apps/ahp/ the following works perfectly fine:

Version: 2.0
Alternatives: &alternatives
  Beach:
    cost: 10000
  Montañas:
    cost: 5000
Goal:
  name: Vacation
  decision-makers:
    #optional node, needed only if not all decision-makers have equal voting power
    - Däd: 0.4
    - Mom: 2/5
    - Kid: 0.2
  preferences:
    Däd:
      pairwise:
      - [Costs, Fön, 4]
      - [Costs, Spa, 9]
      - [Fön, Spa, 4]
    Mom:
      pairwise:
      - [Costs, Fön, 1/4]
      - [Costs, Spa, 1/9]
      - [Fön, Spa, 1/5]
    Kid:
      pairwise:
      - [Costs, Fön, 1/9]
      - [Costs, Spa, 1]
      - [Fön, Spa, 9]
  children:
    Costs:
      preferences:
        Däd:
          pairwiseFunction: 
            function(a1, a2) min(9, max(1/9, a2$cost/a1$cost))
        Mom:
          scoreFunction:
            function(a) 1/a$cost
        Kid:
          priority:
            - Beach: 1/2
            - Montañas: 0.5
      children: *alternatives
    Fön:
      preferences:
        Däd:
          pairwise:
            - [Beach, Montañas, 1/6]
        Mom:
          pairwise:
            - [Beach, Montañas, 2]
        Kid:
        # Often, entering pairwise preferences is lengthy, especially if you
        # have multiple alternatives. Instead, you can enter scores, i.e. rate
        # each alternative on a scale. The scale can be chosen freely. The 
        # priorities are derived as score / sum(scores)
          score:
            - Beach: 5
            - Montañas: 0
      children: *alternatives
    Spa:
      preferences:
        Däd:
          pairwise:
            - [Beach, Montañas, 2]
        Mom:
          pairwise:
            - [Beach, Montañas, 6]
        Kid:
          pairwise:
            - [Beach, Montañas, 1/2]
      children: *alternatives

Can you pls provide a reproducible example of what is not working for you? Ideally as a gist. Thx!

@jjcizi
Copy link
Author

jjcizi commented Jul 7, 2018

Thx for reply. but when I use the yaml code which you give above, still garbled.
Däd, Montañas,etc. changed to garbled.
But it is indeed normal , works, on the the online app at https://ipub.com/dev-corner/apps/ahp/.
Why?

@jjcizi
Copy link
Author

jjcizi commented Jul 7, 2018

solved.

x <- readLines("file.yml")
x <- iconv(x,'UTF-8','UTF-8')
writeLines(x,"file.yml")

use icove() to change file to utf-8 ,then works.

thank you very much.

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

No branches or pull requests

2 participants