utf 8 to latin

  • Posts: 30
  • Thank you received: 0
10 years 8 months ago #146497

when user input data in registration form with utf 8 how to change in latin, because when my plugin get data of inputs and redirect to the bank give me error and when users input data in latin everything is fine.

How to solve this problem?

Last edit: 10 years 8 months ago by mkdhost.

Please Log in or Create an account to join the conversation.

  • Posts: 82868
  • Thank you received: 13377
  • MODERATOR
10 years 8 months ago #146552

You can use our encoding helper:
$encodingHelper = hikashop_get('helper.encoding');
$latin_text = $encodingHelper->change($utf8_text,'UTF-8','ISO-8859-1');

Please Log in or Create an account to join the conversation.

  • Posts: 30
  • Thank you received: 0
10 years 8 months ago #146570

components/com_hikashop/controllers address.php in this file is address inputs or to add in payment plugin? Sugestion

Please Log in or Create an account to join the conversation.

  • Posts: 82868
  • Thank you received: 13377
  • MODERATOR
10 years 8 months ago #146590

If you're developing a payment plugin, I suppose that you want to convert your text before sending it to the payment gateway, so of course in your payment plugin.

Please Log in or Create an account to join the conversation.

  • Posts: 846
  • Thank you received: 92
10 years 8 months ago #146602

Hi
a- Could you explain why developer need to handle /manage utf-8 function in joomla or Hikashop extension or php ?
OS , http server , SQL database , programming language files should in 2014 all be compatible ( configure ) with utf-8 ? .
Windows OS from Microsoft don't support real utf -8 .

b- Does the helper function is document somwhere in hikashop website ?

c- python choose by default the encoding of the OS so since i use windows 8.1 64 bits i have for python
for getdefaultencoding => 'ascii'
for getdefaultlocale() => ('fr_FR','cp1252')
no standart in 2014 beetween OS .Internet try to create standart by force browser to follow standart !!

Regard's

Last edit: 10 years 8 months ago by lionel75.

Please Log in or Create an account to join the conversation.

  • Posts: 82868
  • Thank you received: 13377
  • MODERATOR
10 years 8 months ago #146689

Hi,

1. Windows supports UTF8. Why do you think it doesn't ?
You need to handle UTF8 because old software are not always compatible with it. Old email servers for example, or old payment gateways.

2. No. That's a function specific to HikaShop internals and should not have to be used for third party developers since everything should use UTF8. And if you need to use encoding conversions, PHP has functions for that (iconv, utt8_encode, etc) which are actually what is done by our helper.

3. I would recommend to tell that to python developers. They probably have a good reason for that. PHP uses UTF8 by default since PHP5.0 I think.

Please Log in or Create an account to join the conversation.

  • Posts: 30
  • Thank you received: 0
10 years 8 months ago #147005

This is log from bank...
FirstName = '????'
LastName = '???????????'
PostalCode = '1000'
Address = '????? ?????? ?? 7-2/12'
City = '??????'
Country = 'Macedonia'

way give me ? when post with cyrilic?

I try with $FirstName = $encodingHelper->change($utf8_text,'UTF-8','ISO-8859-1'); but nothing.

Last edit: 10 years 8 months ago by mkdhost.

Please Log in or Create an account to join the conversation.

  • Posts: 30
  • Thank you received: 0
10 years 8 months ago #147021

this is for payment plugin.

Please Log in or Create an account to join the conversation.

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
10 years 8 months ago #147097

Hi,

Which payment plugin are talking about ?
Are you sure that the text is in UTF-8 and can be convert into ISO-8859-1 ?
Are you sure the other payment platform is supporting the ISO-8859-1 format ?

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

Please Log in or Create an account to join the conversation.

  • Posts: 30
  • Thank you received: 0
10 years 8 months ago #147098

i can't post parametars with utf8

from banks system send me log with FirstName='????'

FirstName='коки'
length of the field FirstName 008
What does your application field of 4 characters calculated length 8

Last edit: 10 years 8 months ago by mkdhost.

Please Log in or Create an account to join the conversation.

  • Posts: 30
  • Thank you received: 0
10 years 8 months ago #147105

i create new pament plugin for casys macedonia for hikashop.

cpay.com.mk

Please Log in or Create an account to join the conversation.

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
10 years 8 months ago #147102

Hi,

I am sorry but "коки" can't be converted into ISO-8859-1.
It is just not possible.
You can try it youself:

<?php
$a = 'коки';
echo utf8_decode($a);

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

Please Log in or Create an account to join the conversation.

  • Posts: 30
  • Thank you received: 0
10 years 8 months ago #147174

req. log from bank:

all data value send to the system must to be utf8 encoding

Please Log in or Create an account to join the conversation.

  • Posts: 30
  • Thank you received: 0
10 years 8 months ago #147175

$temp=utf8_decode($AmountToPay); also for other fields.

FATAL param[FirstName].Length=4 , given length in CheckSumHeader =8 this is because before get lengt for field i must to encod to the UTF8 with utf8_decode(field)you think problem will be solved?

Last edit: 10 years 8 months ago by mkdhost.

Please Log in or Create an account to join the conversation.

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
10 years 8 months ago #147178

Hi,

So, I am sorry but the problem comes from your plugin.
The data is already in UTF8 and you can simply use the "strlen" function to get the string length of a UTF8 string.

I don't know how your plugin works and what it has to do but if you don't need to convert the UTF8 to latin, you just have to use it.

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

Please Log in or Create an account to join the conversation.

  • Posts: 30
  • Thank you received: 0
10 years 8 months ago #147637

$AmountToPay = $order->order_full_price*100;
$PayToMerchant = $method->payment_params->merchantid;
$MerchantName = 'XXXX';.......etc for $AmountCurrency ,$Details1 ,$Details2

next
$zero = '0';
$password = 'XXXXX';
//$password = $method->payment_params->encriptionkey;
$len_AmountToPay = strlen($AmountToPay);
$len_PayToMerchant = strlen($PayToMerchant);
$len_MerchantName = strlen($MerchantName); etc
next
if ($len_AmountToPay<10) {
$nula_AmountToPay = '0';
}
else {
$nula_AmountToPay = '';
}
next
$parameters_value = $zero.$nula_AmountToPay.$len_AmountToPay.$zero.$nula_PayToMerchant.$len_PayToMerchant.$.....etc


$CheckSumHeader = '16AmountToPay,PayToMerchant,MerchantName,....etc'.$parameters_value;

$CheckSum = $CheckSumHeader.$AmountToPay.$PayToMerchant.$MerchantName.$AmountCurrency.$Details1.$Details2.etc;

$CheckSum_control = md5($CheckSum);

<form id="hikashop_casys_form" name="hikashop_casys_form" action="<?php echo $gateway_url?>" method="post" >
<input id='AmountToPay' name='AmountToPay' value='<?php echo $AmountToPay; ?>' type='hidden' />
..... etc other input.


FATAL param[FirstName].Length=4 , given length in CheckSumHeader =8 this is because before get lengt for field i must to encod to the UTF8 with utf8_decode(field)you think problem will be solved?

Please Log in or Create an account to join the conversation.

  • Posts: 82868
  • Thank you received: 13377
  • MODERATOR
10 years 8 months ago #147647

That error means that the way you generate the checksum is not correct based on your payment gateway API. It's not about the encoding. And since your bank said that they accept UTF8 characters, there is no need to convert the texts as they are already by default in UTF8.

Please Log in or Create an account to join the conversation.

  • Posts: 30
  • Thank you received: 0
10 years 8 months ago #148012

this code very good work for latin! but problem is when users use UTF 8

Please Log in or Create an account to join the conversation.

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
10 years 8 months ago #148013

Hi,

the checksum is not correct based on your payment gateway API

Like Nicolas said, the problem is in your payment gateway API, not in HikaShop.
Your problem is not related to HikaShop or his encoding, so please contact your payment gateway support and see with them own to solve this problem.
But we can't do anything for you because it is not an HikaShop problem.

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

Please Log in or Create an account to join the conversation.

  • Posts: 30
  • Thank you received: 0
10 years 8 months ago #148179

he say me problem is in my code .... and that. Send me a log and say me your file not supported utf8 . :evil: :evil: :evil: :evil: :evil: :evil: :evil: :evil: :evil:

Please Log in or Create an account to join the conversation.

Time to create page: 0.099 seconds
Powered by Kunena Forum