Closed Fernandacarmo closed 4 years ago
Please provide a sample schema to test with
Well, basically I have a UTF-8 table with some Latin characters:
But when I run the generator it creates the class mentioned before with non-UTF-8 encoding.
CREATE TABLE ppro_payment_method ( ppro_payment_method_id BIGSERIAL NOT NULL, ppro_payment_method_name VARCHAR NOT NULL, ppro_payment_method_tag VARCHAR NOT NULL, ppro_payment_method_title text, CONSTRAINT ppro_payment_method_pkey PRIMARY KEY (ppro_payment_method_id), CONSTRAINT ppro_payment_method_unique UNIQUE (ppro_payment_method_name) ); COMMENT ON TABLE ppro_payment_method IS 'PPRO payment method data'; COMMENT ON COLUMN ppro_payment_method.ppro_payment_method_id IS 'Primary key for ppro_payment_method'; COMMENT ON COLUMN ppro_payment_method.ppro_payment_method_name IS 'Name of ppro_payment_method'; COMMENT ON COLUMN ppro_payment_method.ppro_payment_method_tag IS 'Tag of payment method seen on requests'; COMMENT ON COLUMN ppro_payment_method.ppro_payment_method_title IS 'Title of the payment method';
ALTER SEQUENCE ppro_payment_method_ppro_payment_method_id_seq RESTART WITH 1000 INCREMENT BY 50 NO MINVALUE NO MAXVALUE CACHE 1;
INSERT INTO ppro_payment_method (ppro_payment_method_id, ppro_payment_method_name, ppro_payment_method_tag, ppro_payment_method_title) VALUES (0, 'NOT_APPLICABLE', 'notapplicable', 'Not Applicable'), (1, 'DUMB_DUMMY', 'dumbdummy', 'Dumb Dummy'), (2, 'BANCO_DO_BRASIL', 'bancodobrasil', 'Banco do Brasil'), (3, 'POLI', 'poli', 'POLi'), (4, 'OXXO', 'oxxo', 'OXXO'), (5, 'SANTANDER', 'santander', 'Santander'), --(6, 'SANTANDER_CASH_PAYMENT', 'santandercash', 'Santander Cash'), DELETED (7, 'PAGO_FACIL', 'pagofacil', 'Pago Fácil'), (8, 'RAPI_PAGO', 'rapipago', 'Rapi Pago'), (9, 'ARGENCARD', 'argencard', 'Argencard'), (10, 'CABAL', 'cabal', 'Cabal'), (11, 'CENCOSUD', 'cencosud', 'Cencosud'), (12, 'NARANJA', 'naranja', 'Tarjeta Naranja'), (13, 'NATIVA', 'nativa', 'Nativa'), (14, 'TARJETA_SHOPPING', 'tarjetashopping', 'Tarjeta Shopping'), (15, 'PAY_SAFE_CARD', 'paysafecard', 'paysafecard'), (16, 'EPS', 'eps', 'eps'), (17, 'BRADESCO', 'bradesco', 'Bradesco'), (18, 'ITAU', 'itau', 'Itaú'), (19, 'BOLETO_BANCARIO', 'boleto', 'Boleto Bancário'), (20, 'ELO', 'elo', 'Elo'), (21, 'AURA', 'aura', 'Aura'), (22, 'SAFETY_PAY', 'safetypay', 'SafetyPay'), (23, 'WEB_PAY', 'webpay', 'WebPay'), (24, 'PSE', 'pse', 'Pagos Seguros en Linea - PSE'), (25, 'EFECTY', 'efecty', 'Efecty'), (26, 'BALOTO', 'baloto', 'Baloto'), (27, 'TRUST_PAY', 'trustpay', 'TrustPay'), (28, 'PAY_U', 'payu', 'PayU'), (29, 'ESTONIAN_BANKS', 'estonianbanks', 'Estonian Banks'), (30, 'PAYSERA', 'paysera', 'Paysera'), (31, 'VERKKOPANKKI', 'verkkopankki', 'Verkkopankki'), (32, 'ZIMPLER', 'pugglepay', 'Zimpler'), (33, 'GIROPAY', 'giropay', 'giropay'), (34, 'INSTANT_TRANSFER', 'instanttransfer', 'InstantTransfer'), (35, 'MY_BANK', 'mybank', 'MyBank'), (36, 'QIWI', 'qiwi', 'QIWI'), (37, 'LATVIAN_BANKS', 'latvianbanks', 'Latvian Banks'), (38, 'LITHUANIAN_BANKS', 'lithuanianbanks', 'Lithuanian Banks'), (39, 'MAXIMA', 'maxima', 'Maxima'), (40, 'NARVESEN', 'narvesen', 'Narvesen'), (41, 'PAY_POST', 'paypost', 'PayPost'), (42, 'PERLAS_TERMINALS', 'perlas', 'Perlas Terminals'), (43, 'IDEAL', 'ideal', 'iDEAL'), (44, 'BLIK', 'blik', 'BLIK'), (45, 'PRZELEWY_24', 'p24', 'Przelewy24'), (46, 'MULTIBANCO', 'multibanco', 'Multibanco'), (47, 'REDPAGOS', 'redpagos', 'Redpagos'), (48, 'BANCONTACT', 'bcmc', 'Bancontact'), (49, 'PAY_BY_BANK_APP', 'pbba', 'PaybyBank app');
I think you need to change VelocityWriters file, all instances looking like: PrintWriter classWriter = new PrintWriter(new BufferedWriter(new FileWriter(tmp, false)));
into PrintWriter classWriter = new PrintWriter(new BufferedWriter(new OutputStreamWriter(new FileOutputStream(tmp, false), "UTF-8")));
If you can provide a PR which confirms it works I'll merge it in.
PR merged.
Hi Wallace, I'm working with your generator here in MiFinity. We use database PostgreSQL with UTF-8 encoding. I've created a table that has some data with Latin characters (Itaú, for example) and I need the equivalent ENUM to be generated with UTF-8 encoding (like the table). However, the ENUM is generated with wrong encoding: ANSI
Is there any change you can make in your generator to generate UTF-8 encoding, please? Thanks, Fernanda.