Skip to content

Instantly share code, notes, and snippets.

View hakanai's full-sized avatar
⚔️
Battling i16n demons

Hakanai hakanai

⚔️
Battling i16n demons
View GitHub Profile
irb(main):030:0> a1 = "\u1000".encode('UTF-16LE').to_sym
=> :"\u1000"
irb(main):031:0> a2 = "\u1000".encode('UTF-16BE').to_sym
=> :"\u1000"
irb(main):032:0> a1
=> :"\u1000"
irb(main):033:0> a2
=> :"\u1000"
irb(main):034:0> a1 == a2
=> false
@hakanai
hakanai / gist:11165579
Created April 22, 2014 04:46
More JRuby strangeness, this time it's Unicode filenames
bucket:test $ irb
irb(main):001:0> RUBY_VERSION
=> "2.0.0"
irb(main):002:0> l = Dir.glob('*')
=> ["café"]
irb(main):003:0> l[0].encoding
=> #<Encoding:UTF-8>
irb(main):004:0> l[0].bytes
=> [99, 97, 102, 101, 204, 129]
irb(main):005:0> ^D
@Test
public void test1() throws Exception
{
System.setSecurityManager(null);
startJfxThread();
final CountDownLatch latch = new CountDownLatch(1);
Platform.runLater(new Runnable()
Rika:git trejkaz$ git init .
Initialized empty Git repository in /Users/trejkaz/test/git/.git/
# Simulate the editor returning an error
Rika:git trejkaz$ echo "exit 2" > "break-me"
Rika:git trejkaz$ chmod a+x break-me
Rika:git trejkaz$ export EDITOR=./break-me
Rika:git trejkaz$ git commit
error: There was a problem with the editor './break-me'.
puts "Before:"
p licence.nested_licences
licence.save!
puts "After (directly from model):"
p Licence.order('created_at DESC').first.id
p Licence.order('created_at DESC').first.nested_licences
puts "After (via organisation):"
@hakanai
hakanai / gist:3ebc2ffcadf65700e483
Created June 1, 2014 10:27
Who said a Java exception can't kill the entire app?
Process: idea [94180]
Path: /Applications/IntelliJ IDEA 13 CE.app/Contents/MacOS/idea
Identifier: com.jetbrains.intellij.ce
Version: 13.1.3 (IC-135.909)
Code Type: X86-64 (Native)
Parent Process: launchd [162]
Responsible: idea [94180]
User ID: 502
Date/Time: 2014-06-01 20:27:29.061 +1000
Caused by: properties_functions.js:12 TypeError: Java method [jdk.internal.dynalink.beans.SimpleDynamicMethod InputStream java.nio.file.Files.newInputStream(Path,OpenOption[])] cant be used as a constructor.
tl;dr
Essentially, Microsoft extended Shift_JIS but did so by essentially putting all the additional
characters into JIS X 0208. Since JIS X 0208 is also used by ISO-2022-JP, this means you can
find invalid ISO-2022-JP which Microsoft can still read.
Apparently some people are exploiting this as a "feature" as it is not the first time I have
seen the same thing requested.
You can decode this god-awful shit by hand if you are sufficiently bored. Here's how!
Rika:Downloads trejkaz$ codesign -v ~/Downloads/ATLauncher.app
/Users/trejkaz/Downloads/ATLauncher.app: invalid Info.plist (plist or signature have been modified)
In architecture: x86_64
Rika:Downloads trejkaz$ codesign -s "Trejkaz" -f ATLauncher.app
ATLauncher.app: replacing existing signature
Rika:Downloads trejkaz$ codesign -v ATLauncher.app
Rika:Downloads trejkaz$
java.lang.NullPointerException
at net.minecraft.server.MinecraftServer.func_71233_x(MinecraftServer.java:795)
at net.minecraft.command.CommandServerList.func_71515_b(SourceFile:25)
at net.minecraft.command.CommandHandler.func_71556_a(CommandHandler.java:88)
at net.minecraft.server.dedicated.DedicatedServer.func_71333_ah(DedicatedServer.java:315)
at net.minecraft.server.dedicated.DedicatedServer.func_71228_a(DedicatedServer.java:242)
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:527)
at net.minecraft.server.ThreadMinecraftServer.run(SourceFile:583)