I first thought your shaft/bore difference was 6mm to 1/4". However the 1/2" bore is another problem. If it were just the small diff, the JB weld would work OK. With the larger bore to deal with, your only option is make a bushing to fit the 6mm encoder shaft. This is a lathe job, of course. If you have no facilities, I could make one for you.
The finished bushing can be put into the 1/2" coupling bore using Loctite #271, Red label. This stuff is super strong, and permanent. After it is set, you can drill on through the set screw hole, and run a tap all the way.
The website "stepperonline" has shaft couplings, and the type I prefer have a red non-metallic center piece, with the two hubs engaging the center with alternate teeth. The have many sized of different mating bores, but the 6mm largest opposing hub bore was 10 mm. Then the major OD of the hub jumped from 20mm to 30 mm. The 12.7mm bore is equal to 1/2", but the starting small side was bigger than 6mm. You can check them out. It has lots of steppers and amps also.
John