Trouble with cyrillic names while using SVN through PHP "exec" command

Posted on 2008-06-25
Last Modified: 2010-05-18
Im using SVN through PHP "exec" command. File encoding and input parameters - UTF-8. Im sending utf-8 string through "5xec" as well. Command is folder creating:

exec('svn mkdir -m "" --username username --password password '.escapeshellarg(SVN_HOST.$name))

where $name is folder name.

When I use this comand, trying to create folder with english name - folder is created successfully. But when Im trying to create folder with cyrillic name - no luck, "exec" returns nothing. While using the same command through the command line (not through PHP) cyrillic folder is created successfully. I verify encoding using mb_*
environment: WindowsXP, Apache 2.x, PHP5.2.6, svn1.4.6.

Please advice, how to implement creating a folder with cyrillic name in SVN through PHP "exec" command. And provide code sample with encodings you have used (file and input parameters encoding)
Question by:technoparkcorp
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3

Expert Comment

ID: 21864435
As long as you deal with SVN you have to use URL encoding of dir specifications. So replace $name with something like urlencode($name) in your code, this should be the fix.

Please read on the matter with SVN, and on notes on different aspects of PHP URL encoding (you may face one). You may also take a look at SVN function in PHP itself (say, svn_fs_make_dir would be right one for you), but SVN support in PHP still experimental yet.

Author Comment

ID: 21865359
No luck. While using urlencode(folder_name), the folder is added, but the name looks like "22 33 22 44 23"

Expert Comment

ID: 21865686
Well just use iconv to have your folder name in windows-1251 and not in UTF8 encoding. Use iconv like this:

  ...' . escapeshellarg(urlencode(SVN_HOST.iconv('UTF-8', 'windows-1251', $name)))

Good luck this time!
Threat Trends for MSPs to Watch

See the findings.
Despite its humble beginnings, phishing has come a long way since those first crudely constructed emails. Today, phishing sites can appear and disappear in the length of a coffee break, and it takes more than a little know-how to keep your clients secure.


Author Comment

ID: 21876198
No luck again. " 2F EF E0 EF EA E0" - this folder is created, not proper cyrillic name.

Please advice, how to implement creating a folder with cyrillic name in SVN through PHP "exec" command. And provide code sample with encodings you have used (file and input parameters encoding)

Accepted Solution

snrudda earned 500 total points
ID: 21882518
Don't have SVN hands but shortly I'd ask you to assign value of exec to file and compare that to string that you given from commend line. I bet you'll get the idea yourself pretty easy.

After all iconv a bit tricky program and PHP iconv support add up some trickiness too. "Play & play & play & don't touch ever after".

PHP SVN support is experimental, and this is PECL extension. Go to see to get more info on how to install it and use but beware it may be changed.

Expert Comment

ID: 21882537
...I mean I don't have access to my SVN right now neither will have it soon, so I'm sad to answer pretty out of my mind. But compare cli command and the one you issue with exec, this will show you the way.

Author Closing Comment

ID: 31470497
thank you, that was rather helpful

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you thought ransomware was bad, think again! Doxware has the potential to be even more damaging.
This paper addresses the security of Sennheiser DECT Contact Center and Office (CC&O) headsets. It describes the DECT security chain comprised of “Pairing”, “Per Call Authentication” and “Encryption”, which are all part of the standard DECT protocol.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

738 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question