Oracle Text In cards.txt Files
Post MTG Forge Related Programming Questions Here
Moderators: timmermac, Blacksmith, KrazyTheFox, Agetian, friarsol, CCGHQ Admins
62 posts
• Page 4 of 5 • 1, 2, 3, 4, 5
Re: Oracle Text In cards.txt Files
by Chris H. » 26 Jun 2011, 21:26
`Braids wrote:here is why. examining the card in that rev, a hex editor shows the byte 0x9e is present where the "LATIN SMALL LETTER U WITH CIRCUMFLEX" belongs. this is neither UTF-8 nor ISO-Latin-1. it is Macintosh specific: http://kb.iu.edu/data/aeqb.html
edit 1: 0x9e isn't even defined by ISO-Latin-1. but in the Windows-1252 encoding, you get the accented Z. http://en.wikipedia.org/wiki/Windows-1252 (column E, row 9)
Wow.
UTF-8 and ISO-8859-1 and now Mac OS Roman plus Windows-1252.
It has been an interesting and educational day.
I reverted my card name change.

-
Chris H. - Forge Moderator
- Posts: 6320
- Joined: 04 Nov 2008, 12:11
- Location: Mac OS X Yosemite
- Has thanked: 644 times
- Been thanked: 643 times
Re: Oracle Text In cards.txt Files
by Snacko » 26 Jun 2011, 22:12
whole solution is to convert utf-8 to unicode as this is what Java uses for strings sample code that fixes all the issues with names showing wrong characters.
- Code: Select all
try {
t = new String(t.getBytes(), "UTF-8");
} catch (UnsupportedEncodingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Re: Oracle Text In cards.txt Files
by Braids » 26 Jun 2011, 23:17
yes, but the best place to do this is where the file is being loaded. having UTF-8 encoded Strings running around is unnecessarily confusing and error prone. the UTF-8 must be decoded as part of the process of creating the String in the first place. that is why we must make a decision about the character encoding of the file itself.Snacko wrote:whole solution is to convert utf-8 to unicode as this is what Java uses for strings
here is how to read a UTF-8 encoded file into Java:
- Code: Select all
FileInputStream inStream;
InputStreamReader streamReader;
BufferedReader bufReader;
try {
inStream = new FileInputStream(file);
streamReader = new InputStreamReader(inStream, "UTF-8");
bufReader = new BufferedReader(streamReader);
String line = bufReader.getLine();
// ...
}
// TODO catch Exceptions here, like UnsupportedEncodingException
finally {
try { bufReader.close(); } catch (Exception ignored) { ; }
try { streamReader.close(); } catch (Exception ignored) { ; }
try { inStream.close(); } catch (Exception ignored) { ; }
}
for the short term, i think ascii is still the best plan. we have bigger fish to fry.
"That is the dumbest thing I've ever seen." --Rob Cashwalker, regarding Innistrad double-sided cards. One of the first times he and I have ever agreed on something. 

-
Braids - Programmer
- Posts: 556
- Joined: 22 Jun 2011, 00:39
- Location: Unknown. Hobby: Driving myself and others to constructive madness.
- Has thanked: 1 time
- Been thanked: 1 time
changing the default charset for txt files
by Braids » 27 Jun 2011, 00:39
in a fit of irony, i found myself editing the very file that loads card data from disk. this is in my current effort to modify CardFactory to load cards on demand instead of all at once. of course, there are parts of the code that want all the cards loaded all at once anyway. i'm not fixing those yet.Braids wrote:. . . the best place to do this is where the file is being loaded.
- Code: Select all
public class ReadCard implements Runnable, NewConstants {
public static final String DEFAULT_CHARSET_NAME = "US-ASCII";
//...
}
apologies in advance to Rob. i am trying to limit the number of files i change in this effort, but it is more than i originally anticipated. hmm, there are some files where i only added comments. i can commit those in the next couple of hours. it's a plan.
"That is the dumbest thing I've ever seen." --Rob Cashwalker, regarding Innistrad double-sided cards. One of the first times he and I have ever agreed on something. 

-
Braids - Programmer
- Posts: 556
- Joined: 22 Jun 2011, 00:39
- Location: Unknown. Hobby: Driving myself and others to constructive madness.
- Has thanked: 1 time
- Been thanked: 1 time
Re: Oracle Text In cards.txt Files
by friarsol » 27 Jun 2011, 02:24
Alright, so back to the original point of this thread. Should I be doing anything to the Oracle text of the cards with non-ASCII characters? I'll hold off committing the updated script, I just was gone most of the weekend and didn't get to read up on anything conclusive.
- friarsol
- Global Moderator
- Posts: 7593
- Joined: 15 May 2010, 04:20
- Has thanked: 243 times
- Been thanked: 965 times
Re: Oracle Text In cards.txt Files
by Braids » 27 Jun 2011, 02:32
despite the change i made, i'm still voting ascii, so that gives ascii a narrow margin of one vote.friarsol wrote:Alright, so back to the original point of this thread. Should I be doing anything to the Oracle text of the cards with non-ASCII characters? I'll hold off committing the updated script, I just was gone most of the weekend and didn't get to read up on anything conclusive.
i guess i can unilaterally declare the voting over and recommend total conversion to ascii.
"That is the dumbest thing I've ever seen." --Rob Cashwalker, regarding Innistrad double-sided cards. One of the first times he and I have ever agreed on something. 

-
Braids - Programmer
- Posts: 556
- Joined: 22 Jun 2011, 00:39
- Location: Unknown. Hobby: Driving myself and others to constructive madness.
- Has thanked: 1 time
- Been thanked: 1 time
Re: Oracle Text In cards.txt Files
by friarsol » 27 Jun 2011, 02:36
You can?Braids wrote:i guess i can unilaterally declare the voting over and recommend total conversion to ascii.
- friarsol
- Global Moderator
- Posts: 7593
- Joined: 15 May 2010, 04:20
- Has thanked: 243 times
- Been thanked: 965 times
Re: Oracle Text In cards.txt Files
by Rob Cashwalker » 27 Jun 2011, 02:39
ascii... I was testing the sealed mode missing land issue, and kept getting exceptions because Dandan can't be found by CardFactory.
edit - look, the forum recognizes Dandan without the funny looking "a".
edit - look, the forum recognizes Dandan without the funny looking "a".
The Force will be with you, Always.
-
Rob Cashwalker - Programmer
- Posts: 2167
- Joined: 09 Sep 2008, 15:09
- Location: New York
- Has thanked: 5 times
- Been thanked: 40 times
votes so far
by Braids » 27 Jun 2011, 03:06
- ascii: Braids, friarsol, Rob Cashwalker
- utf-8: Hellfish
- abstain: Chris H., Jaedayr
ascii wins 3:1.
"That is the dumbest thing I've ever seen." --Rob Cashwalker, regarding Innistrad double-sided cards. One of the first times he and I have ever agreed on something. 

-
Braids - Programmer
- Posts: 556
- Joined: 22 Jun 2011, 00:39
- Location: Unknown. Hobby: Driving myself and others to constructive madness.
- Has thanked: 1 time
- Been thanked: 1 time
Re: Oracle Text In cards.txt Files
by Braids » 27 Jun 2011, 03:08
imp mode: yes, but its oracle text includes the circumflex over the a.Rob Cashwalker wrote:look, the forum recognizes Dandan without the funny looking "a".

i'm still voting ascii in the card text.
"That is the dumbest thing I've ever seen." --Rob Cashwalker, regarding Innistrad double-sided cards. One of the first times he and I have ever agreed on something. 

-
Braids - Programmer
- Posts: 556
- Joined: 22 Jun 2011, 00:39
- Location: Unknown. Hobby: Driving myself and others to constructive madness.
- Has thanked: 1 time
- Been thanked: 1 time
Re: Oracle Text In cards.txt Files
by Rob Cashwalker » 27 Jun 2011, 04:02
Braids - don't be afraid to include more than one response in a post... use the edit button if necessary... I know you're new and trying to bump up your post count....
Yes, I did notice that it uses the weird a in the text...
Why exactly did all this come up anyway? Just because the Oracle text friarsol is going to use may include weird characters that don't match our card names? The Oracle text part is just for human reference... I think our brains can skip to the punchline, and ignore weird symbols. As long as Card.getName is consistent with existing data, then Forge is functional. The printed text of the card can be anything, it doesn't have to match a deck file...
Yes, I did notice that it uses the weird a in the text...
Why exactly did all this come up anyway? Just because the Oracle text friarsol is going to use may include weird characters that don't match our card names? The Oracle text part is just for human reference... I think our brains can skip to the punchline, and ignore weird symbols. As long as Card.getName is consistent with existing data, then Forge is functional. The printed text of the card can be anything, it doesn't have to match a deck file...
The Force will be with you, Always.
-
Rob Cashwalker - Programmer
- Posts: 2167
- Joined: 09 Sep 2008, 15:09
- Location: New York
- Has thanked: 5 times
- Been thanked: 40 times
Re: Oracle Text In cards.txt Files
by Braids » 27 Jun 2011, 04:15
actually, i wasn't considering my post count at all. does the subscription system notify its subscribers if i edit a post? i have been assuming it didn't.Rob Cashwalker wrote:Braids - don't be afraid to include more than one response in a post... use the edit button if necessary... I know you're new and trying to bump up your post count....
yes, but if those weird symbols are a math radical symbol following by a backwards Russian R, when it's supposed to be a LATIN SMALL LETTER A WITH MACRON, it not only looks really really bad, it is beyond the realm of sensible legibility. those are the kinds of behavior we were getting.Rob Cashwalker wrote:Why exactly did all this come up anyway? Just because the Oracle text friarsol is going to use may include weird characters that don't match our card names? The Oracle text part is just for human reference... I think our brains can skip to the punchline, and ignore weird symbols.
the oracle text has to undergo transformation for mana and tap symbols anyway; we may as well asciify it to make it legible. also, function is not everything.
"That is the dumbest thing I've ever seen." --Rob Cashwalker, regarding Innistrad double-sided cards. One of the first times he and I have ever agreed on something. 

-
Braids - Programmer
- Posts: 556
- Joined: 22 Jun 2011, 00:39
- Location: Unknown. Hobby: Driving myself and others to constructive madness.
- Has thanked: 1 time
- Been thanked: 1 time
Re: Oracle Text In cards.txt Files
by Hellfish » 27 Jun 2011, 11:25
It's like election night with all the vote tracking 
I'll edit this post when things are back to normal.
EDIT:Done as of r10097.

I'll edit this post when things are back to normal.
EDIT:Done as of r10097.
Last edited by Hellfish on 27 Jun 2011, 11:47, edited 1 time in total.
So now you're
Screaming for the blood of the cookie monster
Evil puppet demon of obesity
Time to change the tune of his fearful ballad
C is for "Lettuce," that's good enough for me
Screaming for the blood of the cookie monster
Evil puppet demon of obesity
Time to change the tune of his fearful ballad
C is for "Lettuce," that's good enough for me
-
Hellfish - Programmer
- Posts: 1297
- Joined: 07 Jun 2009, 10:41
- Location: South of the Pumphouse
- Has thanked: 110 times
- Been thanked: 169 times
Re: Oracle Text In cards.txt Files
by Rob Cashwalker » 27 Jun 2011, 11:35
Braids, just a little gentle hazing... no harm. To be honest, I don't know much about the subscription mode....
The Force will be with you, Always.
-
Rob Cashwalker - Programmer
- Posts: 2167
- Joined: 09 Sep 2008, 15:09
- Location: New York
- Has thanked: 5 times
- Been thanked: 40 times
Re: Oracle Text In cards.txt Files
by ZzzzSleep » 27 Jun 2011, 11:45
Even though all I've done is script some cards, my vote (if I get one) is to use the ascii version of the text. Otherwise, somebody could have the situation of a cursed scroll in play and no idea how to type 'Ærathi Berserker'.
62 posts
• Page 4 of 5 • 1, 2, 3, 4, 5
Who is online
Users browsing this forum: No registered users and 25 guests